Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix internal error when missing measure attribute in an unsolved measure typar #18234

Merged
merged 7 commits into from
Jan 20, 2025

Conversation

edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Jan 13, 2025

Description

Fixes #7491

type A<[<Measure>]'u>(x : int<'u>) =
    member this.X = x

module M =
    type A<'u> with // Note the missing Measure attribute
        member this.Y = this.X

BEFORE

Ok.fs(6,25): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

Ok.fs(6,25): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

Ok.fs(5,5): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

Ok.fs(5,5): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

Ok.fs(4,1): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

Ok.fs(1,1): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

Ok.fs(1,1): error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

error FS0192: internal error: remapMeasureAux: incorrect kinds

error FS0073: internal error: remapMeasureAux: incorrect kinds (Failure)

error FS0192: internal error: remapMeasureAux: incorrect kinds

Unhandled Exception: System.Exception: remapMeasureAux: incorrect kinds

AFTER

(Error 3874, Line 9, Col 12, Line 9, Col 14, "Expected unit-of-measure type parameter must be marked with the [<Measure>] attribute.")

Checklist

  • Test cases added
  • Release notes entry updated

Copy link
Contributor

github-actions bot commented Jan 13, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.300.md

@edgarfgp edgarfgp changed the title Fix internal error when missing measure attribute in a unsolved measure typar Fix internal error when missing measure attribute in an unsolved measure typar Jan 13, 2025
@psfinaki
Copy link
Member

@edgarfgp a question, partially orthogonal and out of curiosity.

While doing the investigation, have you got an understanding on why is the attribute duplication actually needed there?

AFAIU (might be wrong, you are the attribute guru here) - inheritance should work normally for attributes, so attribute properties should apply to the derived entities.

I'm getting a suspicion that something is broken more deeply here. I've noticed different behavior between C# and F# here:
image

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Jan 14, 2025

@psfinaki Yeah I think you are hitting #17107 ?

Edit: Will try and investigate this during NET10 timeframe.

@psfinaki
Copy link
Member

Right - told ya, you're the attribute guru. At least that's a known issue then...

@edgarfgp edgarfgp marked this pull request as ready for review January 18, 2025 17:59
@edgarfgp edgarfgp requested a review from a team as a code owner January 18, 2025 17:59
@T-Gro T-Gro merged commit 5bfbc6d into dotnet:main Jan 20, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
3 participants