Skip to content

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

Merged
T-Gro merged 7 commits into
dotnet:mainfrom
edgarfgp:fix-7491
Jan 20, 2025
Merged

Fix internal error when missing measure attribute in an unsolved measure typar#18234
T-Gro merged 7 commits into
dotnet:mainfrom
edgarfgp:fix-7491

Conversation

@edgarfgp

@edgarfgpedgarfgp commented Jan 13, 2025

Copy link
Copy Markdown
Contributor

Description

Fixes#7491

typeA<[<Measure>]'u>(x : int<'u>)=memberthis.X= x
moduleM =typeA<'u>with// Note the missing Measure attributememberthis.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

@github-actions

github-actionsBot commented Jan 13, 2025

Copy link
Copy Markdown
Contributor

❗ Release notes required


✅ Found changes and release notes in following paths:

Change pathRelease notes pathDescription
src/Compilerdocs/release-notes/.FSharp.Compiler.Service/9.0.300.md

@edgarfgpedgarfgp changed the title Fix internal error when missing measure attribute in a unsolved measure typarFix internal error when missing measure attribute in an unsolved measure typarJan 13, 2025
Comment threadsrc/Compiler/FSComp.txt
@psfinaki

Copy link
Copy Markdown
Contributor

@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

edgarfgp commented Jan 14, 2025

Copy link
Copy Markdown
ContributorAuthor

@psfinaki Yeah I think you are hitting #17107 ?

Edit: Will try and investigate this during NET10 timeframe.

@psfinaki

Copy link
Copy Markdown
Contributor

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

@edgarfgpedgarfgp reopened this Jan 14, 2025
@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 ownerJanuary 18, 2025 17:59
@T-Gro
T-Gro merged commit 5bfbc6d into dotnet:mainJan 20, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Compiler fails with internal error when user forgets the Measure attribute when extending a generic type which requires it

3 participants

@edgarfgp@psfinaki@T-Gro