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
* Better error message for pattern matching* Better error message for pattern matching guards* fix test* Test pattern match guards* s/return type/have type
Copy file name to clipboardExpand all lines: src/fsharp/FSComp.txt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,9 @@ listElementHasWrongType,"All elements of a list constructor expression must have
21
21
arrayElementHasWrongType,"All elements of an array constructor expression must have the same type. This expression was expected to have type '%s', but here has type '%s'."
22
22
missingElseBranch,"The 'if' expression is missing an 'else' branch. The 'then' branch has type '%s'. Because 'if' is an expression, and not a statement, add an 'else' branch which returns a value of the same type."
23
23
ifExpression,"The 'if' expression needs to have type '%s' to satisfy context type requirements. It currently has type '%s'."
24
-
elseBranchHasWrongType,"All branches of an 'if' expression must return the same type. This expression was expected to have type '%s', but here has type '%s'."
24
+
elseBranchHasWrongType,"All branches of an 'if' expression must have the same type. This expression was expected to have type '%s', but here has type '%s'."
25
+
followingPatternMatchClauseHasWrongType,"All branches of a pattern match expression must have the same type. This expression was expected to have type '%s', but here has type '%s'."
26
+
patternMatchGuardIsNotBool,"A pattern match guard must be of type 'bool', but this 'when' expression is of type '%s'."
25
27
commaInsteadOfSemicolonInRecord,"A ';' is used to separate field values in records. Consider replacing ',' with ';'."
26
28
derefInsteadOfNot,"The '!' operator is used to dereference a ref cell. Consider using 'not expr' here."
27
29
buildUnexpectedTypeArgs,"The non-generic type '%s' does not expect any type arguments, but here is given %d type argument(s)"
Copy file name to clipboardExpand all lines: tests/fsharp/typecheck/sigs/neg20.bsl
+2-5Lines changed: 2 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -110,12 +110,9 @@ but given a
110
110
'B list'
111
111
The type 'A' doesnot match the type 'B'
112
112
113
-
neg20.fs(83,47,83,54): typecheck error FS0001: All branches of an 'if' expression mustreturn the same type. This expression was expectedto have type 'B', but here has type 'C'.
113
+
neg20.fs(83,47,83,54): typecheck error FS0001: All branches of an 'if' expression musthave the same type. This expression was expectedto have type 'B', but here has type 'C'.
114
114
115
-
neg20.fs(87,54,87,61): typecheck error FS0001: This expression was expectedto have type
116
-
'B'
117
-
but here has type
118
-
'C'
115
+
neg20.fs(87,54,87,61): typecheck error FS0001: All branches of a pattern match expression must have the same type. This expression was expectedto have type 'B', but here has type 'C'.
119
116
120
117
neg20.fs(92,19,92,26): typecheck error FS0001: This expression was expectedto have type
Copy file name to clipboardExpand all lines: tests/fsharp/typecheck/sigs/neg80.vsbsl
+1-4Lines changed: 1 addition & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,6 @@ neg80.fsx(79,5,79,6): parse error FS0010: Unexpected symbol '|' in pattern match
3
3
4
4
neg80.fsx(79,5,79,6): parse error FS0010: Unexpected symbol '|' in pattern matching
5
5
6
-
neg80.fsx(79,6,79,6): typecheck error FS0001: This expression was expected to have type
7
-
'string'
8
-
but here has type
9
-
'unit'
6
+
neg80.fsx(79,6,79,6): typecheck error FS0001: All branches of a pattern match expression must have the same type. This expression was expected to have type 'string', but here has type 'unit'.
10
7
11
8
neg80.fsx(76,11,76,13): typecheck error FS0025: Incomplete pattern matches on this expression. For example, the value 'Horizontal (_, _)' may indicate a case not covered by the pattern(s).
//<Expects status="Error" span="(7,10)">All branches of an 'if' expression mustreturn the same type. This expression was expected to have type 'string', but here has type 'int'.</Expects>
2
+
//<Expects status="Error" span="(7,10)">All branches of an 'if' expression musthave the same type. This expression was expected to have type 'string', but here has type 'int'.</Expects>
//<Expects status="Error">All branches of an 'if' expression mustreturn the same type. This expression was expected to have type 'string', but here has type 'int'.</Expects>
2
+
//<Expects status="Error">All branches of an 'if' expression musthave the same type. This expression was expected to have type 'string', but here has type 'int'.</Expects>