You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tests/FSharp.Compiler.ComponentTests/ErrorMessages/ErrorOnInvalidDeclsInTypeDefinitions.fs
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,48 @@ type IFace =
23
23
(Error 58, Line 6, Col 5, Line 6, Col 11,"Modules cannot be nested inside types. Define modules at module or namespace level.")
24
24
]
25
25
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
+
26
68
[<Fact>]
27
69
let``No Error when module is inside interface``()=
0 commit comments