forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move existing Compiler.ComponentTests to a new Compiler.fs framework (d…
…otnet#9839) * Move existing Compiler.ComponentTests to a new Compiler.fs framework; Add 'parse' function * Changed some wording in error messages
- Loading branch information
1 parent
29047e9
commit d2b545e
Showing
25 changed files
with
630 additions
and
720 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
tests/FSharp.Compiler.ComponentTests/ConstraintSolver/MemberConstraints.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/FSharp.Compiler.ComponentTests/ConstraintSolver/PrimitiveConstraints.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 31 additions & 32 deletions
63
tests/FSharp.Compiler.ComponentTests/ErrorMessages/AccessOfTypeAbbreviationTests.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,74 @@ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
||
namespace FSharp.Compiler.ErrorMessages.ComponentTests | ||
namespace FSharp.Compiler.ComponentTests.ErrorMessages | ||
|
||
open Xunit | ||
open FSharp.Test.Utilities | ||
open FSharp.Test.Utilities.Compiler | ||
open FSharp.Compiler.SourceCodeServices | ||
|
||
module ``Access Of Type Abbreviation`` = | ||
|
||
let warning44Message = "This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in." + System.Environment.NewLine + "As of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors." | ||
|
||
[<Fact>] | ||
let ``Private type produces warning when trying to export``() = | ||
CompilerAssert.TypeCheckSingleError | ||
""" | ||
FSharp """ | ||
module Library = | ||
type private Hidden = Hidden of unit | ||
type Exported = Hidden | ||
""" | ||
FSharpErrorSeverity.Warning | ||
44 | ||
(4, 8, 4, 16) | ||
("This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in." + System.Environment.NewLine + "As of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors.") | ||
""" | ||
|> typecheck | ||
|> shouldFail | ||
|> withSingleDiagnostic (Warning 44, Line 4, Col 8, Line 4, Col 16, warning44Message) | ||
|
||
[<Fact>] | ||
let ``Internal type passes when abbrev is internal``() = | ||
CompilerAssert.Pass | ||
""" | ||
FSharp """ | ||
module Library = | ||
type internal Hidden = Hidden of unit | ||
type internal Exported = Hidden | ||
""" | ||
""" | ||
|> typecheck | ||
|> shouldSucceed | ||
|
||
[<Fact>] | ||
let ``Internal type produces warning when trying to export``() = | ||
CompilerAssert.TypeCheckSingleError | ||
""" | ||
FSharp """ | ||
module Library = | ||
type internal Hidden = Hidden of unit | ||
type Exported = Hidden | ||
""" | ||
FSharpErrorSeverity.Warning | ||
44 | ||
(4, 8, 4, 16) | ||
("This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in." + System.Environment.NewLine + "As of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors.") | ||
""" | ||
|> typecheck | ||
|> shouldFail | ||
|> withSingleDiagnostic (Warning 44, Line 4, Col 8, Line 4, Col 16, warning44Message) | ||
|
||
[<Fact>] | ||
let ``Private type produces warning when abbrev is internal``() = | ||
CompilerAssert.TypeCheckSingleError | ||
""" | ||
FSharp """ | ||
module Library = | ||
type private Hidden = Hidden of unit | ||
type internal Exported = Hidden | ||
""" | ||
FSharpErrorSeverity.Warning | ||
44 | ||
(4, 17, 4, 25) | ||
("This construct is deprecated. The type 'Hidden' is less accessible than the value, member or type 'Exported' it is used in." + System.Environment.NewLine + "As of F# 4.1, the accessibility of type abbreviations is checked at compile-time. Consider changing the accessibility of the type abbreviation. Ignoring this warning might lead to runtime errors.") | ||
""" | ||
|> typecheck | ||
|> shouldFail | ||
|> withSingleDiagnostic (Warning 44, Line 4, Col 17, Line 4, Col 25, warning44Message) | ||
|
||
[<Fact>] | ||
let ``Private type passes when abbrev is private``() = | ||
CompilerAssert.Pass | ||
""" | ||
FSharp """ | ||
module Library = | ||
type private Hidden = Hidden of unit | ||
type private Exported = Hidden | ||
""" | ||
""" | ||
|> typecheck | ||
|> shouldSucceed | ||
|
||
[<Fact>] | ||
let ``Default access type passes when abbrev is default``() = | ||
CompilerAssert.Pass | ||
""" | ||
FSharp """ | ||
module Library = | ||
type Hidden = Hidden of unit | ||
type Exported = Hidden | ||
""" | ||
""" | ||
|> typecheck | ||
|> shouldSucceed |
19 changes: 8 additions & 11 deletions
19
tests/FSharp.Compiler.ComponentTests/ErrorMessages/AssignmentErrorTests.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | ||
|
||
namespace FSharp.Compiler.ErrorMessages.ComponentTests | ||
namespace FSharp.Compiler.ComponentTests.ErrorMessages | ||
|
||
open Xunit | ||
open FSharp.Test.Utilities | ||
open FSharp.Compiler.SourceCodeServices | ||
|
||
open FSharp.Test.Utilities.Compiler | ||
|
||
module ``Errors assigning to mutable objects`` = | ||
|
||
[<Fact>] | ||
let ``Assign to immutable error``() = | ||
CompilerAssert.TypeCheckSingleError | ||
""" | ||
FSharp """ | ||
let x = 10 | ||
x <- 20 | ||
""" | ||
FSharpErrorSeverity.Error | ||
27 | ||
(3, 1, 3, 8) | ||
"This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'." | ||
""" | ||
|> typecheck | ||
|> shouldFail | ||
|> withSingleDiagnostic (Error 27, Line 3, Col 1, Line 3, Col 8, | ||
"This value is not mutable. Consider using the mutable keyword, e.g. 'let mutable x = expression'.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
tests/FSharp.Compiler.ComponentTests/ErrorMessages/ConfusingTypeName.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.