diff --git a/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs b/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs new file mode 100644 index 00000000000..70def908d11 --- /dev/null +++ b/tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace FSharp.Compiler.UnitTests + +open NUnit.Framework +open FSharp.Compiler.SourceCodeServices + +[] +module NameResolutionTests = + + [] + let FieldNotInRecord () = + CompilerAssert.TypeCheckSingleError + """ +type A = { Hello:string; World:string } +type B = { Size:int; Height:int } +type C = { Wheels:int } +type D = { Size:int; Height:int; Walls:int } +type E = { Unknown:string } +type F = { Wallis:int; Size:int; Height:int; } + +let r:F = { Size=3; Height=4; Wall=1 } + """ + FSharpErrorSeverity.Error + 1129 + (9, 31, 9, 35) + "The record type 'F' does not contain a label 'Wall'." + + [] + let RecordFieldProposal () = + CompilerAssert.TypeCheckSingleError + """ +type A = { Hello:string; World:string } +type B = { Size:int; Height:int } +type C = { Wheels:int } +type D = { Size:int; Height:int; Walls:int } +type E = { Unknown:string } +type F = { Wallis:int; Size:int; Height:int; } + +let r = { Size=3; Height=4; Wall=1 } + """ + FSharpErrorSeverity.Error + 39 + (9, 29, 9, 33) + "The record label 'Wall' is not defined." \ No newline at end of file diff --git a/tests/fsharp/FSharpSuite.Tests.fsproj b/tests/fsharp/FSharpSuite.Tests.fsproj index ec2a852b131..fe3d1656a91 100644 --- a/tests/fsharp/FSharpSuite.Tests.fsproj +++ b/tests/fsharp/FSharpSuite.Tests.fsproj @@ -36,6 +36,7 @@ + diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs deleted file mode 100644 index 4a5361f8f67..00000000000 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_FieldNotInRecord.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #ErrorMessages #NameResolution -//The record type 'F' does not contain a label 'Wall'\. - -type A = { Hello:string; World:string } -type B = { Size:int; Height:int } -type C = { Wheels:int } -type D = { Size:int; Height:int; Walls:int } -type E = { Unknown:string } -type F = { Wallis:int; Size:int; Height:int; } - -let r:F = { Size=3; Height=4; Wall=1 } - -exit 0 diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs index b369ffad37f..9bde0edbc4f 100644 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs +++ b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_GlobalQualifierAfterDot.fs @@ -3,4 +3,4 @@ let x = global.System.String.Empty.global.System.String.Empty -exit 0 +exit 0 \ No newline at end of file diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs b/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs deleted file mode 100644 index ca73d5c1e54..00000000000 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/E_RecordFieldProposal.fs +++ /dev/null @@ -1,13 +0,0 @@ -// #ErrorMessages #NameResolution -//The record label 'Wall' is not defined\. - -type A = { Hello:string; World:string } -type B = { Size:int; Height:int } -type C = { Wheels:int } -type D = { Size:int; Height:int; Walls:int } -type E = { Unknown:string } -type F = { Wallis:int; Size:int; Height:int; } - -let r = { Size=3; Height=4; Wall=1 } - -exit 0 diff --git a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst index 42209ddd28e..71bc0eb3900 100644 --- a/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst +++ b/tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst @@ -1,3 +1 @@ - SOURCE=E_RecordFieldProposal.fs # E_RecordFieldProposal - SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot - SOURCE=E_FieldNotInRecord.fs # E_FieldNotInRecord \ No newline at end of file +SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot \ No newline at end of file