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
let``Warn successfully for SynExpr.Ident app`` ()=
10
+
"""
11
+
namespace N
12
+
13
+
module M =
14
+
15
+
let f (a: int list) = a
16
+
17
+
let g () = f [1] // should not warn
18
+
19
+
let h () = f[1] // should warn
20
+
"""
21
+
|> FSharp
22
+
|> withLangVersion70
23
+
|> compile
24
+
|> shouldFail
25
+
|> withResults
26
+
[
27
+
{
28
+
Error = Information 3365
29
+
Range =
30
+
{
31
+
StartLine =10
32
+
StartColumn =20
33
+
EndLine =10
34
+
EndColumn =24
35
+
}
36
+
Message =
37
+
"The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'."
38
+
}
39
+
]
40
+
41
+
[<FSharp.Test.FactForNETCOREAPP>]
42
+
let``Warn successfully for SynExpr.LongIdent app`` ()=
43
+
"""
44
+
namespace N
45
+
46
+
module N =
47
+
48
+
type C () =
49
+
member _.MyFunc (inputList: int list) = inputList
50
+
51
+
let g () =
52
+
let c = C()
53
+
let _ = c.MyFunc [23] // should not warn
54
+
c.MyFunc[42] // should warn
55
+
"""
56
+
|> FSharp
57
+
|> withLangVersion70
58
+
|> compile
59
+
|> shouldFail
60
+
|> withResults
61
+
[
62
+
{
63
+
Error = Information 3365
64
+
Range =
65
+
{
66
+
StartLine =12
67
+
StartColumn =13
68
+
EndLine =12
69
+
EndColumn =25
70
+
}
71
+
Message =
72
+
"The syntax 'expr1[expr2]' is used for indexing. Consider adding a type annotation to enable indexing, or if calling a function add a space, e.g. 'expr1 [expr2]'."
0 commit comments