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
Hint in error for string constants matching expected variant (#7711)
* add dedicated error message for when passing a string constant to something that expects a variant/polyvariant, and that string constant matches one of the constructors
* changelog
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,7 @@
25
25
26
26
- Configuration fields `bs-dependencies`, `bs-dev-dependencies` and `bsc-flags` are now deprecated in favor of `dependencies`, `dev-dependencies` and `compiler-flags`. https://github.com/rescript-lang/rescript/pull/7658
27
27
- Better error message if platform binaries package is not found. https://github.com/rescript-lang/rescript/pull/7698
28
+
- Hint in error for string constants matching expected variant/polyvariant constructor. https://github.com/rescript-lang/rescript/pull/7711
28
29
- Polish arity mismatch error message a bit. https://github.com/rescript-lang/rescript/pull/7709
[1;31m8[0m [2m│[0m let x = doStuff(1, [1;31m"ONE"[0m)
8
+
9 [2m│[0m
9
+
10
+
This has type: [1;31mstring[0m
11
+
But this function argument is expecting: [1;33m[#ONE | #TWO][0m
12
+
13
+
Possible solutions:
14
+
- The constant passed matches one of the expected polymorphic variant constructors. Did you mean to pass this as a polymorphic variant? If so, rewrite [1;33m"ONE"[0m to [1;33m#ONE
[1;31m11[0m [2m│[0m let result = processStatus([1;31m"Active"[0m)
8
+
12 [2m│[0m
9
+
10
+
This has type: [1;31mstring[0m
11
+
But this function argument is expecting: [1;33mstatus[0m
12
+
13
+
Possible solutions:
14
+
- The constant passed matches the runtime representation of one of the expected variant constructors. Did you mean to pass this as a variant constructor? If so, rewrite [1;33m"Active"[0m to [1;33mActive
0 commit comments