Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions tests/fsharp/Compiler/ErrorMessages/NameResolutionTests.fs
Original file line number Diff line number Diff line change
@@ -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

[<TestFixture>]
module NameResolutionTests =

[<Test>]
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'."

[<Test>]
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."
1 change: 1 addition & 0 deletions tests/fsharp/FSharpSuite.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<Compile Include="Compiler\ErrorMessages\AccessOfTypeAbbreviationTests.fs" />
<Compile Include="Compiler\ErrorMessages\ElseBranchHasWrongTypeTests.fs" />
<Compile Include="Compiler\ErrorMessages\MissingElseBranch.fs" />
<Compile Include="Compiler\ErrorMessages\NameResolutionTests.fs" />
<Compile Include="Compiler\ErrorMessages\UpcastDowncastTests.fs" />
<Compile Include="Compiler\SourceTextTests.fs" />
<Compile Include="Compiler\Language\AnonRecordTests.fs" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

let x = global.System.String.Empty.global.System.String.Empty

exit 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kMutagene,

Do you propose following up with a PR to migrate this test case? Feel free to add whatever is necessary to the CompilerAssert class.

Thanks

Kevin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the new function is already coming in #7244 - so after merging that one @kMutagene can continue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK the new assertion function is in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @forki

exit 0

This file was deleted.

4 changes: 1 addition & 3 deletions tests/fsharpqa/Source/ErrorMessages/NameResolution/env.lst
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
SOURCE=E_RecordFieldProposal.fs # E_RecordFieldProposal
SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot
SOURCE=E_FieldNotInRecord.fs # E_FieldNotInRecord
SOURCE=E_GlobalQualifierAfterDot.fs # E_GlobalQualifierAfterDot