- 
                Notifications
    
You must be signed in to change notification settings  - Fork 833
 
Fix internal error when missing measure attribute in an unsolved measure typar #18234
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
Changes from all commits
80ef337
              822da08
              b8561be
              0491582
              154661d
              1ee9b57
              5ed5c8e
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
| 
     | 
||
| module ErrorMessages.UnitOfMeasureTests | ||
| 
     | 
||
| open Xunit | ||
| open FSharp.Test.Compiler | ||
| 
     | 
||
| [<Fact>] | ||
| let ``Error - Expected unit-of-measure type parameter must be marked with the [<Measure>] attribute.`` () = | ||
| Fsx """ | ||
| type A<[<Measure>]'u>(x : int<'u>) = | ||
| member this.X = x | ||
| 
     | 
||
| type B<'u>(x: 'u) = | ||
| member this.X = x | ||
| 
     | 
||
| module M = | ||
| type A<'u> with // Note the missing Measure attribute | ||
| member this.Y = this.X | ||
| 
     | 
||
| type B<'u> with | ||
| member this.Y = this.X | ||
| 
     | 
||
| open System.Runtime.CompilerServices | ||
| type FooExt = | ||
| [<Extension>] | ||
| static member Bar(this: A<'u>, value: A<'u>) = this | ||
| """ | ||
| |> typecheck | ||
| |> shouldFail | ||
| |> withDiagnostics [ | ||
| (Error 3874, Line 9, Col 12, Line 9, Col 14, "Expected unit-of-measure type parameter must be marked with the [<Measure>] attribute.") | ||
| ] | ||
| 
     | 
||
| [<Fact>] | ||
| let ``Expected unit-of-measure type parameter must be marked with the [<Measure>] attribute.`` () = | ||
| Fsx """ | ||
| type A<[<Measure>]'u>(x : int<'u>) = | ||
| member this.X = x | ||
| 
     | 
||
| module M = | ||
| type A<[<Measure>] 'u> with // Note the Measure attribute | ||
| member this.Y = this.X | ||
| 
     | 
||
| open System.Runtime.CompilerServices | ||
| type FooExt = | ||
| [<Extension>] | ||
| static member Bar(this: A<'u>, value: A<'u>) = this | ||
| """ | ||
| |> typecheck | ||
| |> shouldSucceed | ||
| 
     | 
Uh oh!
There was an error while loading. Please reload this page.