Fix some incorrect error messages

This commit is contained in:
Richard Feldman 2025-08-15 18:36:00 -04:00
parent cc597648a0
commit 0bd77fe6af
No known key found for this signature in database
25 changed files with 277 additions and 104 deletions

View file

@ -14,9 +14,22 @@ main : I64, I64 -> I64
main = |_, _| helper(5)
~~~
# EXPECTED
NIL
TYPE MISMATCH - lambda_ret_constraint_bug.md:4:18:4:19
# PROBLEMS
NIL
**TYPE MISMATCH**
This expression is used in an unexpected way:
**lambda_ret_constraint_bug.md:4:18:4:19:**
```roc
helper = |n| n * 2
```
^
It is of type:
_Num(_size)_
But you are trying to use it as:
_I64_
# TOKENS
~~~zig
KwApp(1:1-1:4),OpenSquare(1:5-1:6),LowerIdent(1:6-1:10),CloseSquare(1:10-1:11),OpenCurly(1:12-1:13),LowerIdent(1:14-1:16),OpColon(1:16-1:17),KwPlatform(1:18-1:26),StringStart(1:27-1:28),StringPart(1:28-1:45),StringEnd(1:45-1:46),CloseCurly(1:47-1:48),
@ -112,9 +125,9 @@ NO CHANGE
~~~clojure
(inferred-types
(defs
(patt @4.1-4.7 (type "I64 -> I64"))
(patt @7.1-7.5 (type "I64, I64 -> I64")))
(patt @4.1-4.7 (type "Error -> Error"))
(patt @7.1-7.5 (type "Error, Error -> Error")))
(expressions
(expr @4.10-4.19 (type "I64 -> I64"))
(expr @7.8-7.24 (type "I64, I64 -> I64"))))
(expr @4.10-4.19 (type "Error -> Error"))
(expr @7.8-7.24 (type "Error, Error -> Error"))))
~~~