Skip to content

Commit adcd373

Browse files
committed
more test updates
1 parent a412c6b commit adcd373

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

tests/FSharp.Compiler.ComponentTests/ErrorMessages/ErrorOnInvalidDeclsInTypeDefinitions.fs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,48 @@ type IFace =
2323
(Error 58, Line 6, Col 5, Line 6, Col 11, "Modules cannot be nested inside types. Define modules at module or namespace level.")
2424
]
2525

26+
[<Fact>]
27+
let ``Version10: Error when module is inside interface verbose syntax``() =
28+
Fsx """
29+
module TestModule
30+
31+
type IFace =
32+
interface
33+
abstract F : int -> int
34+
module M =
35+
let f () = f ()
36+
end
37+
"""
38+
|> withLangVersion10
39+
|> typecheck
40+
|> shouldFail
41+
|> withDiagnostics [
42+
(Error 546, Line 5, Col 5, Line 5, Col 14, "Unmatched 'class', 'interface' or 'struct'");
43+
(Error 10, Line 7, Col 9, Line 7, Col 15, "Unexpected keyword 'module' in member definition");
44+
(Error 10, Line 9, Col 5, Line 9, Col 8, "Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.")
45+
]
46+
47+
[<Fact>]
48+
let ``Error when module is inside interface verbose syntax``() =
49+
Fsx """
50+
module TestModule
51+
52+
type IFace =
53+
interface
54+
abstract F : int -> int
55+
module M =
56+
let f () = f ()
57+
end
58+
"""
59+
|> withLangVersion90
60+
|> typecheck
61+
|> shouldFail
62+
|> withDiagnostics [
63+
(Error 546, Line 5, Col 5, Line 5, Col 14, "Unmatched 'class', 'interface' or 'struct'");
64+
(Error 10, Line 7, Col 9, Line 7, Col 15, "Unexpected keyword 'module' in member definition");
65+
(Error 10, Line 9, Col 5, Line 9, Col 8, "Incomplete structured construct at or before this point in definition. Expected incomplete structured construct at or before this point or other token.")
66+
]
67+
2668
[<Fact>]
2769
let ``No Error when module is inside interface``() =
2870
Fsx """

tests/fsharp/typecheck/sigs/neg01.bsl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
neg01a.fsi(24,15,24,19): parse error FS0058: Nested type definitions are not allowed. Types must be defined at module or namespace level.
33

44
neg01a.fs(22,15,22,19): parse error FS0058: Nested type definitions are not allowed. Types must be defined at module or namespace level.
5+
6+
neg01a.fsi(24,8,25,7): typecheck error FS0913: Types cannot contain nested type definitions
7+
8+
neg01a.fs(22,8,23,7): typecheck error FS0913: Types cannot contain nested type definitions
9+
10+
neg01b.fs(2,13,2,14): typecheck error FS0039: The value, constructor, namespace or type 'X' is not defined.

0 commit comments

Comments
 (0)