Update snapshots

This commit is contained in:
Richard Feldman 2025-08-15 15:24:57 -04:00
parent 7109e5f3fd
commit 47c83c7a8f
No known key found for this signature in database
30 changed files with 157 additions and 186 deletions

View file

@ -1443,19 +1443,20 @@ fn checkBinopExpr(self: *Self, expr_idx: CIR.Expr.Idx, expr_region: Region, bino
switch (binop.op) { switch (binop.op) {
.add, .sub, .mul, .div, .rem, .pow, .div_trunc => { .add, .sub, .mul, .div, .rem, .pow, .div_trunc => {
// For arithmetic operations, create a shared number type for operands and result // For arithmetic operations, check operands normally first, then unify
var does_fx = try self.checkExpr(binop.lhs);
does_fx = try self.checkExpr(binop.rhs) or does_fx;
// Get operand variables
const lhs_var = @as(Var, @enumFromInt(@intFromEnum(binop.lhs)));
const rhs_var = @as(Var, @enumFromInt(@intFromEnum(binop.rhs)));
const result_var = @as(Var, @enumFromInt(@intFromEnum(expr_idx))); const result_var = @as(Var, @enumFromInt(@intFromEnum(expr_idx)));
// Create a fresh number variable that all operands should match // Unify operands - they must be the same type
const num_content = Content{ .structure = .{ .num = .{ .num_unbound = .{ .sign_needed = false, .bits_needed = 0 } } } }; _ = try self.unify(lhs_var, rhs_var);
const shared_num_var = try self.freshFromContent(num_content, expr_region);
// Check operands with the shared numeric type as expected // Result should have the same type as the operands
var does_fx = try self.checkExprWithExpected(binop.lhs, shared_num_var); _ = try self.unify(result_var, lhs_var);
does_fx = try self.checkExprWithExpected(binop.rhs, shared_num_var) or does_fx;
// Result should also be of the same numeric type
_ = try self.unify(result_var, shared_num_var);
return does_fx; return does_fx;
}, },

View file

@ -61,7 +61,7 @@ add2 = x + 2
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @3.1-3.5 (type "Num(_size)"))) (patt @3.1-3.5 (type "Error")))
(expressions (expressions
(expr @3.8-3.18 (type "Num(_size)")))) (expr @3.8-3.18 (type "Error"))))
~~~ ~~~

View file

@ -33,7 +33,7 @@ main! = |_| {
~~~ ~~~
# EXPECTED # EXPECTED
UNUSED VARIABLE - bound_type_var_no_annotation.md:19:5:19:9 UNUSED VARIABLE - bound_type_var_no_annotation.md:19:5:19:9
TYPE MISMATCH - bound_type_var_no_annotation.md:22:21:22:22 TYPE MISMATCH - bound_type_var_no_annotation.md:11:18:11:19
# PROBLEMS # PROBLEMS
**UNUSED VARIABLE** **UNUSED VARIABLE**
Variable `pair` is not used anywhere in your code. Variable `pair` is not used anywhere in your code.
@ -48,17 +48,17 @@ The unused variable is declared here:
**TYPE MISMATCH** **TYPE MISMATCH**
The first argument to this function is not what I expect: This expression is used in an unexpected way:
**bound_type_var_no_annotation.md:22:21:22:22:** **bound_type_var_no_annotation.md:11:18:11:19:**
```roc ```roc
result = addOne(5) addOne = |n| n + 1
``` ```
^ ^
This argument is of type: It is of type:
_Num(_size)_ _Num(_size)_
But the function needs the first argumument to be: But you are trying to use it as:
_U64_ _U64_
# TOKENS # TOKENS
@ -277,11 +277,11 @@ main! = |_| {
(defs (defs
(patt @3.1-3.9 (type "_arg -> _ret")) (patt @3.1-3.9 (type "_arg -> _ret"))
(patt @7.1-7.8 (type "a, b -> (a, b)")) (patt @7.1-7.8 (type "a, b -> (a, b)"))
(patt @11.1-11.7 (type "U64 -> U64")) (patt @11.1-11.7 (type "Error -> Error"))
(patt @13.1-13.6 (type "_arg -> Error"))) (patt @13.1-13.6 (type "_arg -> Error")))
(expressions (expressions
(expr @3.12-3.17 (type "_arg -> _ret")) (expr @3.12-3.17 (type "_arg -> _ret"))
(expr @7.11-7.42 (type "a, b -> (a, b)")) (expr @7.11-7.42 (type "a, b -> (a, b)"))
(expr @11.10-11.19 (type "U64 -> U64")) (expr @11.10-11.19 (type "Error -> Error"))
(expr @13.9-25.2 (type "_arg -> Error")))) (expr @13.9-25.2 (type "_arg -> Error"))))
~~~ ~~~

View file

@ -99,7 +99,7 @@ NO CHANGE
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @4.1-4.9 (type "_arg -> Num(_size)"))) (patt @4.1-4.9 (type "_arg -> _ret")))
(expressions (expressions
(expr @4.12-10.2 (type "_arg -> Num(_size)")))) (expr @4.12-10.2 (type "_arg -> _ret"))))
~~~ ~~~

View file

@ -117,5 +117,5 @@ OpenRound(1:1-1:2),OpBar(1:2-1:3),OpenCurly(1:3-1:4),LowerIdent(1:5-1:6),Comma(1
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-1.89 (type "Num(_size)")) (expr @1.1-1.89 (type "_f"))
~~~ ~~~

View file

@ -64,5 +64,5 @@ NO CHANGE
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-1.37 (type "Num(_size)")) (expr @1.1-1.37 (type "_a"))
~~~ ~~~

View file

@ -40,5 +40,5 @@ NO CHANGE
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-1.10 (type "_arg -> Num(_size)")) (expr @1.1-1.10 (type "Num(_size) -> Num(_size2)"))
~~~ ~~~

View file

@ -43,5 +43,5 @@ NO CHANGE
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-1.13 (type "_arg, _arg2 -> Num(_size)")) (expr @1.1-1.13 (type "_arg, _arg2 -> _ret"))
~~~ ~~~

View file

@ -166,5 +166,5 @@ CloseCurly(10:1-10:2),EndOfFile(10:2-10:2),
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-10.2 (type "{ someTag: [Some(Num(_size))]_others, noneTag: [None]_others2, okTag: Result(Str, err), errTag: Result(ok, Str), addOne: _arg -> Num(_size2), result: _field, nested: [Some(Error)]_others3, tagList: List([Some(Num(_size3))][None]_others4) }")) (expr @1.1-10.2 (type "{ someTag: [Some(Num(_size))]_others, noneTag: [None]_others2, okTag: Result(Str, err), errTag: Result(ok, Str), addOne: Num(_size2) -> Num(_size3), result: _field, nested: [Some(Error)]_others3, tagList: List([Some(Num(_size4))][None]_others4) }"))
~~~ ~~~

View file

@ -153,12 +153,12 @@ NO CHANGE
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @6.1-6.9 (type "_arg, _arg2 -> Num(_size)")) (patt @6.1-6.9 (type "_arg, _arg2 -> _ret"))
(patt @9.1-9.14 (type "_arg -> _ret")) (patt @9.1-9.14 (type "_arg -> _ret"))
(patt @12.1-12.9 (type "_arg -> _ret")) (patt @12.1-12.9 (type "_arg -> _ret"))
(patt @14.1-14.6 (type "_a"))) (patt @14.1-14.6 (type "_a")))
(expressions (expressions
(expr @6.12-6.24 (type "_arg, _arg2 -> Num(_size)")) (expr @6.12-6.24 (type "_arg, _arg2 -> _ret"))
(expr @9.17-9.36 (type "_arg -> _ret")) (expr @9.17-9.36 (type "_arg -> _ret"))
(expr @12.12-12.45 (type "_arg -> _ret")) (expr @12.12-12.45 (type "_arg -> _ret"))
(expr @14.9-14.21 (type "_a")))) (expr @14.9-14.21 (type "_a"))))

View file

@ -16,21 +16,36 @@ wrongTypeFunction : I64 -> I64
wrongTypeFunction = |x| x * 3.14 wrongTypeFunction = |x| x * 3.14
~~~ ~~~
# EXPECTED # EXPECTED
TYPE MISMATCH - lambda_annotation_mismatch_error.md:4:25:4:28 TYPE MISMATCH - lambda_annotation_mismatch_error.md:5:26:5:28
TYPE MISMATCH - lambda_annotation_mismatch_error.md:9:29:9:33
# PROBLEMS # PROBLEMS
**TYPE MISMATCH** **TYPE MISMATCH**
This expression is used in an unexpected way: This expression is used in an unexpected way:
**lambda_annotation_mismatch_error.md:4:25:4:28:** **lambda_annotation_mismatch_error.md:5:26:5:28:**
```roc ```roc
stringFunction : Str -> Str stringFunction = |x| x + 42
``` ```
^^^ ^^
It is of type: It is of type:
_Str_ _Num(_size)_
But you are trying to use it as: But you are trying to use it as:
_Num(_size)_ _Str_
**TYPE MISMATCH**
This expression is used in an unexpected way:
**lambda_annotation_mismatch_error.md:9:29:9:33:**
```roc
wrongTypeFunction = |x| x * 3.14
```
^^^^
It is of type:
_Frac(_size)_
But you are trying to use it as:
_I64_
# TOKENS # TOKENS
~~~zig ~~~zig
@ -116,8 +131,8 @@ NO CHANGE
(inferred-types (inferred-types
(defs (defs
(patt @5.1-5.15 (type "Error -> Error")) (patt @5.1-5.15 (type "Error -> Error"))
(patt @9.1-9.18 (type "I64 -> I64"))) (patt @9.1-9.18 (type "Error -> Error")))
(expressions (expressions
(expr @5.18-5.28 (type "Error -> Error")) (expr @5.18-5.28 (type "Error -> Error"))
(expr @9.21-9.33 (type "I64 -> I64")))) (expr @9.21-9.33 (type "Error -> Error"))))
~~~ ~~~

View file

@ -72,5 +72,5 @@ NO CHANGE
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-1.14 (type "_arg -> _arg2 -> Num(_size)")) (expr @1.1-1.14 (type "Error -> _arg -> Error"))
~~~ ~~~

View file

@ -28,7 +28,6 @@ PARSE ERROR - lambda_currying_constraint.md:12:22:12:23
PARSE ERROR - lambda_currying_constraint.md:12:24:12:25 PARSE ERROR - lambda_currying_constraint.md:12:24:12:25
PARSE ERROR - lambda_currying_constraint.md:12:26:12:28 PARSE ERROR - lambda_currying_constraint.md:12:26:12:28
PARSE ERROR - lambda_currying_constraint.md:12:29:12:30 PARSE ERROR - lambda_currying_constraint.md:12:29:12:30
TYPE MISMATCH - lambda_currying_constraint.md:4:18:4:26
# PROBLEMS # PROBLEMS
**PARSE ERROR** **PARSE ERROR**
A parsing error occurred: `statement_unexpected_token` A parsing error occurred: `statement_unexpected_token`
@ -78,20 +77,6 @@ applyTwice : (a -> a), a -> a
^ ^
**TYPE MISMATCH**
This expression is used in an unexpected way:
**lambda_currying_constraint.md:4:18:4:26:**
```roc
makeAdder : a -> (a -> a)
```
^^^^^^^^
It is of type:
_a -> a_
But you are trying to use it as:
_a -> Num(_size)_
# TOKENS # TOKENS
~~~zig ~~~zig
KwModule(1:1-1:7),OpenSquare(1:8-1:9),LowerIdent(1:9-1:18),Comma(1:18-1:19),LowerIdent(1:20-1:30),Comma(1:30-1:31),LowerIdent(1:32-1:42),CloseSquare(1:42-1:43), KwModule(1:1-1:7),OpenSquare(1:8-1:9),LowerIdent(1:9-1:18),Comma(1:18-1:19),LowerIdent(1:20-1:30),Comma(1:30-1:31),LowerIdent(1:32-1:42),CloseSquare(1:42-1:43),
@ -283,13 +268,13 @@ addThreeTwice = |n| applyTwice(|x| x + 3, n)
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @5.1-5.10 (type "a -> Error")) (patt @5.1-5.10 (type "a -> a -> a"))
(patt @9.1-9.11 (type "Error")) (patt @9.1-9.11 (type "I64 -> I64"))
(patt @13.1-13.11 (type "_arg -> _ret, _arg2 -> _ret2")) (patt @13.1-13.11 (type "_arg -> _ret, _arg2 -> _ret2"))
(patt @17.1-17.14 (type "I64 -> I64"))) (patt @17.1-17.14 (type "I64 -> I64")))
(expressions (expressions
(expr @5.13-5.26 (type "a -> Error")) (expr @5.13-5.26 (type "a -> a -> a"))
(expr @9.14-9.26 (type "Error")) (expr @9.14-9.26 (type "I64 -> I64"))
(expr @13.14-13.28 (type "_arg -> _ret, _arg2 -> _ret2")) (expr @13.14-13.28 (type "_arg -> _ret, _arg2 -> _ret2"))
(expr @17.17-17.45 (type "I64 -> I64")))) (expr @17.17-17.45 (type "I64 -> I64"))))
~~~ ~~~

View file

@ -34,10 +34,7 @@ main! = |_| {
# EXPECTED # EXPECTED
UNUSED VARIABLE - lambda_parameter_unused.md:5:8:5:14 UNUSED VARIABLE - lambda_parameter_unused.md:5:8:5:14
UNDERSCORE VARIABLE USED - lambda_parameter_unused.md:9:22:9:29 UNDERSCORE VARIABLE USED - lambda_parameter_unused.md:9:22:9:29
TYPE MISMATCH - lambda_parameter_unused.md:20:19:20:20 TYPE MISMATCH - lambda_parameter_unused.md:9:32:9:33
TYPE MISMATCH - lambda_parameter_unused.md:21:24:21:25
TYPE MISMATCH - lambda_parameter_unused.md:22:23:22:24
TYPE MISMATCH - lambda_parameter_unused.md:23:22:23:23
# PROBLEMS # PROBLEMS
**UNUSED VARIABLE** **UNUSED VARIABLE**
Variable `unused` is not used anywhere in your code. Variable `unused` is not used anywhere in your code.
@ -64,59 +61,17 @@ multiply = |_factor| _factor * 2
**TYPE MISMATCH** **TYPE MISMATCH**
The first argument to this function is not what I expect: This expression is used in an unexpected way:
**lambda_parameter_unused.md:20:19:20:20:** **lambda_parameter_unused.md:9:32:9:33:**
```roc ```roc
result1 = add(5) multiply = |_factor| _factor * 2
``` ```
^ ^
This argument is of type: It is of type:
_Num(_size)_ _Num(_size)_
But the function needs the first argumument to be: But you are trying to use it as:
_U64_
**TYPE MISMATCH**
The first argument to this function is not what I expect:
**lambda_parameter_unused.md:21:24:21:25:**
```roc
result2 = multiply(3)
```
^
This argument is of type:
_Num(_size)_
But the function needs the first argumument to be:
_U64_
**TYPE MISMATCH**
The first argument to this function is not what I expect:
**lambda_parameter_unused.md:22:23:22:24:**
```roc
result3 = process(7)
```
^
This argument is of type:
_Num(_size)_
But the function needs the first argumument to be:
_U64_
**TYPE MISMATCH**
The first argument to this function is not what I expect:
**lambda_parameter_unused.md:23:22:23:23:**
```roc
result4 = double(4)
```
^
This argument is of type:
_Num(_size)_
But the function needs the first argumument to be:
_U64_ _U64_
# TOKENS # TOKENS
@ -365,15 +320,15 @@ main! = |_| {
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @5.1-5.4 (type "U64 -> U64")) (patt @5.1-5.4 (type "Error -> Error"))
(patt @9.1-9.9 (type "U64 -> U64")) (patt @9.1-9.9 (type "Error -> Error"))
(patt @13.1-13.8 (type "U64 -> U64")) (patt @13.1-13.8 (type "Error -> Error"))
(patt @17.1-17.7 (type "U64 -> U64")) (patt @17.1-17.7 (type "Error -> Error"))
(patt @19.1-19.6 (type "_arg -> Num(_size)"))) (patt @19.1-19.6 (type "_arg -> Error")))
(expressions (expressions
(expr @5.7-5.18 (type "U64 -> U64")) (expr @5.7-5.18 (type "Error -> Error"))
(expr @9.12-9.33 (type "U64 -> U64")) (expr @9.12-9.33 (type "Error -> Error"))
(expr @13.11-13.23 (type "U64 -> U64")) (expr @13.11-13.23 (type "Error -> Error"))
(expr @17.10-17.27 (type "U64 -> U64")) (expr @17.10-17.27 (type "Error -> Error"))
(expr @19.9-25.2 (type "_arg -> Num(_size)")))) (expr @19.9-25.2 (type "_arg -> Error"))))
~~~ ~~~

View file

@ -15,7 +15,7 @@ main = |_, _| helper 5
~~~ ~~~
# EXPECTED # EXPECTED
PARSE ERROR - lambda_ret_constraint_bug.md:7:22:7:23 PARSE ERROR - lambda_ret_constraint_bug.md:7:22:7:23
TYPE MISMATCH - lambda_ret_constraint_bug.md:6:8:6:23 TYPE MISMATCH - lambda_ret_constraint_bug.md:4:18:4:19
# PROBLEMS # PROBLEMS
**PARSE ERROR** **PARSE ERROR**
A parsing error occurred: `statement_unexpected_token` A parsing error occurred: `statement_unexpected_token`
@ -31,17 +31,17 @@ main = |_, _| helper 5
**TYPE MISMATCH** **TYPE MISMATCH**
This expression is used in an unexpected way: This expression is used in an unexpected way:
**lambda_ret_constraint_bug.md:6:8:6:23:** **lambda_ret_constraint_bug.md:4:18:4:19:**
```roc ```roc
main : I64, I64 -> I64 helper = |n| n * 2
``` ```
^^^^^^^^^^^^^^^ ^
It is of type: It is of type:
_I64, I64 -> I64_ _Num(_size)_
But you are trying to use it as: But you are trying to use it as:
_I64, I64 -> I64 -> I64_ _I64_
# TOKENS # TOKENS
~~~zig ~~~zig
@ -142,9 +142,9 @@ main = |_, _| helper
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @4.1-4.7 (type "I64 -> I64")) (patt @4.1-4.7 (type "Error"))
(patt @7.1-7.5 (type "Error"))) (patt @7.1-7.5 (type "Error, Error -> Error")))
(expressions (expressions
(expr @4.10-4.19 (type "I64 -> I64")) (expr @4.10-4.19 (type "Error"))
(expr @7.8-7.21 (type "Error")))) (expr @7.8-7.21 (type "Error, Error -> Error"))))
~~~ ~~~

View file

@ -1083,7 +1083,7 @@ main = |_| {
(patt @85.1-85.9 (type "Num(_size)")) (patt @85.1-85.9 (type "Num(_size)"))
(patt @86.1-86.9 (type "List(Num(_size))")) (patt @86.1-86.9 (type "List(Num(_size))"))
(patt @87.1-87.9 (type "{ base: Num(_size), derived: List(Num(_size2)) }")) (patt @87.1-87.9 (type "{ base: Num(_size), derived: List(Num(_size2)) }"))
(patt @90.1-90.6 (type "{ numbers: { value: Num(_size), list: List(Num(_size2)), float: Frac(_size3) }, strings: { value: Str, list: List(Str) }, empty_lists: { raw: List(Num(_size4)), in_list: List(List(Num(_size5))), in_record: { data: List(Num(_size6)) } }, computations: { from_num: Num(_size7), from_frac: Num(_size8), list_from_num: List(Num(_size9)) } }")) (patt @90.1-90.6 (type "{ numbers: { value: Num(_size), list: List(Num(_size2)), float: Frac(_size3) }, strings: { value: Str, list: List(Str) }, empty_lists: { raw: List(Num(_size4)), in_list: List(List(Num(_size5))), in_record: { data: List(Num(_size6)) } }, computations: { from_num: Num(_size7), from_frac: Frac(_size8), list_from_num: List(Num(_size9)) } }"))
(patt @105.1-105.5 (type "_arg -> Num(_size)"))) (patt @105.1-105.5 (type "_arg -> Num(_size)")))
(expressions (expressions
(expr @4.7-4.9 (type "Num(_size)")) (expr @4.7-4.9 (type "Num(_size)"))
@ -1112,6 +1112,6 @@ main = |_| {
(expr @85.12-85.19 (type "Num(_size)")) (expr @85.12-85.19 (type "Num(_size)"))
(expr @86.12-86.22 (type "List(Num(_size))")) (expr @86.12-86.22 (type "List(Num(_size))"))
(expr @87.12-87.59 (type "{ base: Num(_size), derived: List(Num(_size2)) }")) (expr @87.12-87.59 (type "{ base: Num(_size), derived: List(Num(_size2)) }"))
(expr @90.9-103.2 (type "{ numbers: { value: Num(_size), list: List(Num(_size2)), float: Frac(_size3) }, strings: { value: Str, list: List(Str) }, empty_lists: { raw: List(Num(_size4)), in_list: List(List(Num(_size5))), in_record: { data: List(Num(_size6)) } }, computations: { from_num: Num(_size7), from_frac: Num(_size8), list_from_num: List(Num(_size9)) } }")) (expr @90.9-103.2 (type "{ numbers: { value: Num(_size), list: List(Num(_size2)), float: Frac(_size3) }, strings: { value: Str, list: List(Str) }, empty_lists: { raw: List(Num(_size4)), in_list: List(List(Num(_size5))), in_record: { data: List(Num(_size6)) } }, computations: { from_num: Num(_size7), from_frac: Frac(_size8), list_from_num: List(Num(_size9)) } }"))
(expr @105.8-108.2 (type "_arg -> Num(_size)")))) (expr @105.8-108.2 (type "_arg -> Num(_size)"))))
~~~ ~~~

View file

@ -450,7 +450,7 @@ main = |_| {
(patt @17.1-17.10 (type "_arg -> List(_elem)")) (patt @17.1-17.10 (type "_arg -> List(_elem)"))
(patt @20.1-20.15 (type "List(_elem)")) (patt @20.1-20.15 (type "List(_elem)"))
(patt @21.1-21.15 (type "List(_elem)")) (patt @21.1-21.15 (type "List(_elem)"))
(patt @23.1-23.5 (type "_arg -> Num(_size)"))) (patt @23.1-23.5 (type "_arg -> _ret")))
(expressions (expressions
(expr @4.17-4.19 (type "List(_elem)")) (expr @4.17-4.19 (type "List(_elem)"))
(expr @7.12-7.21 (type "List(Num(_size))")) (expr @7.12-7.21 (type "List(Num(_size))"))
@ -462,5 +462,5 @@ main = |_| {
(expr @17.13-17.19 (type "_arg -> List(_elem)")) (expr @17.13-17.19 (type "_arg -> List(_elem)"))
(expr @20.18-20.31 (type "List(_elem)")) (expr @20.18-20.31 (type "List(_elem)"))
(expr @21.18-21.35 (type "List(_elem)")) (expr @21.18-21.35 (type "List(_elem)"))
(expr @23.8-29.2 (type "_arg -> Num(_size)")))) (expr @23.8-29.2 (type "_arg -> _ret"))))
~~~ ~~~

View file

@ -247,29 +247,29 @@ main = |_| {
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @4.1-4.4 (type "Num(_size)")) (patt @4.1-4.4 (type "Frac(_size)"))
(patt @5.1-5.5 (type "Frac(_size)")) (patt @5.1-5.5 (type "Frac(_size)"))
(patt @8.1-8.8 (type "Num(_size)")) (patt @8.1-8.8 (type "Frac(_size)"))
(patt @9.1-9.10 (type "Frac(_size)")) (patt @9.1-9.10 (type "Frac(_size)"))
(patt @12.1-12.8 (type "Num(_size)")) (patt @12.1-12.8 (type "Frac(_size)"))
(patt @13.1-13.13 (type "Num(_size)")) (patt @13.1-13.13 (type "Frac(_size)"))
(patt @16.1-16.10 (type "Num(_size)")) (patt @16.1-16.10 (type "Frac(_size)"))
(patt @17.1-17.15 (type "Num(_size)")) (patt @17.1-17.15 (type "Frac(_size)"))
(patt @20.1-20.7 (type "_arg -> Num(_size)")) (patt @20.1-20.7 (type "Num(_size) -> Num(_size2)"))
(patt @23.1-23.12 (type "Num(_size)")) (patt @23.1-23.12 (type "Num(_size)"))
(patt @24.1-24.14 (type "Num(_size)")) (patt @24.1-24.14 (type "Frac(_size)"))
(patt @26.1-26.5 (type "_arg -> Num(_size)"))) (patt @26.1-26.5 (type "_arg -> Frac(_size)")))
(expressions (expressions
(expr @4.7-4.9 (type "Num(_size)")) (expr @4.7-4.9 (type "Frac(_size)"))
(expr @5.8-5.11 (type "Frac(_size)")) (expr @5.8-5.11 (type "Frac(_size)"))
(expr @8.11-8.14 (type "Num(_size)")) (expr @8.11-8.14 (type "Frac(_size)"))
(expr @9.13-9.17 (type "Frac(_size)")) (expr @9.13-9.17 (type "Frac(_size)"))
(expr @12.11-12.19 (type "Num(_size)")) (expr @12.11-12.19 (type "Frac(_size)"))
(expr @13.16-13.23 (type "Num(_size)")) (expr @13.16-13.23 (type "Frac(_size)"))
(expr @16.13-16.23 (type "Num(_size)")) (expr @16.13-16.23 (type "Frac(_size)"))
(expr @17.18-17.27 (type "Num(_size)")) (expr @17.18-17.27 (type "Frac(_size)"))
(expr @20.10-20.19 (type "_arg -> Num(_size)")) (expr @20.10-20.19 (type "Num(_size) -> Num(_size2)"))
(expr @23.15-23.24 (type "Num(_size)")) (expr @23.15-23.24 (type "Num(_size)"))
(expr @24.17-24.28 (type "Num(_size)")) (expr @24.17-24.28 (type "Frac(_size)"))
(expr @26.8-29.2 (type "_arg -> Num(_size)")))) (expr @26.8-29.2 (type "_arg -> Frac(_size)"))))
~~~ ~~~

View file

@ -87,5 +87,5 @@ match list {
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-4.2 (type "Num(_size)")) (expr @1.1-4.2 (type "_a"))
~~~ ~~~

View file

@ -129,5 +129,5 @@ match nestedList {
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-5.2 (type "Num(_size)")) (expr @1.1-5.2 (type "_a"))
~~~ ~~~

View file

@ -65,5 +65,5 @@ match value {
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-3.2 (type "Num(_size)")) (expr @1.1-3.2 (type "Error"))
~~~ ~~~

View file

@ -115,5 +115,5 @@ match shape {
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-5.2 (type "Num(_size)")) (expr @1.1-5.2 (type "Frac(_size)"))
~~~ ~~~

View file

@ -111,5 +111,5 @@ match (value, other) {
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-4.2 (type "Num(_size)")) (expr @1.1-4.2 (type "Error"))
~~~ ~~~

View file

@ -115,7 +115,7 @@ I'm having trouble with this nominal tag:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The tag is: The tag is:
_RGBA(U8, U8, U8, Num(_size))_ _RGBA(U8, U8, U8, Frac(_size))_
But it should be one of: But it should be one of:
_[Hex(Str), Named(Str), RGB(U8, U8, U8), RGBA(U8, U8, U8, Dec)]_ _[Hex(Str), Named(Str), RGB(U8, U8, U8), RGBA(U8, U8, U8, Dec)]_

View file

@ -234,5 +234,5 @@ CloseCurly(15:1-15:2),EndOfFile(15:2-15:2),
~~~ ~~~
# TYPES # TYPES
~~~clojure ~~~clojure
(expr @1.1-15.2 (type "{ name: Str, scores: List(Num(_size)), status: [Active({ since: Str })]_others, preferences: { theme: [Dark]_others2, notifications: [Email(Str)]_others3 }, metadata: Result({ tags: List(Str), permissions: List([Read]_others4) }, err), callback: _arg -> Num(_size2), nested: { items: List([Some(Str)][None]_others5), result: [Success({ data: List(Num(_size3)), timestamp: Str })]_others6 } }")) (expr @1.1-15.2 (type "{ name: Str, scores: List(Num(_size)), status: [Active({ since: Str })]_others, preferences: { theme: [Dark]_others2, notifications: [Email(Str)]_others3 }, metadata: Result({ tags: List(Str), permissions: List([Read]_others4) }, err), callback: Num(_size2) -> Num(_size3), nested: { items: List([Some(Str)][None]_others5), result: [Success({ data: List(Num(_size4)), timestamp: Str })]_others6 } }"))
~~~ ~~~

View file

@ -16,21 +16,36 @@ addTwoF64 : F64 -> F64
addTwoF64 = |x| x + 2.0 addTwoF64 = |x| x + 2.0
~~~ ~~~
# EXPECTED # EXPECTED
TYPE MISMATCH - simple_lambda_constraint_success.md:8:20:8:23 TYPE MISMATCH - simple_lambda_constraint_success.md:5:18:5:19
TYPE MISMATCH - simple_lambda_constraint_success.md:9:21:9:24
# PROBLEMS # PROBLEMS
**TYPE MISMATCH** **TYPE MISMATCH**
This expression is used in an unexpected way: This expression is used in an unexpected way:
**simple_lambda_constraint_success.md:8:20:8:23:** **simple_lambda_constraint_success.md:5:18:5:19:**
```roc ```roc
addTwoF64 : F64 -> F64 addTwo = |x| x + 2
```
^
It is of type:
_Num(_size)_
But you are trying to use it as:
_I64_
**TYPE MISMATCH**
This expression is used in an unexpected way:
**simple_lambda_constraint_success.md:9:21:9:24:**
```roc
addTwoF64 = |x| x + 2.0
``` ```
^^^ ^^^
It is of type: It is of type:
_F64_ _Frac(_size)_
But you are trying to use it as: But you are trying to use it as:
_Num(_size)_ _F64_
# TOKENS # TOKENS
~~~zig ~~~zig
@ -115,9 +130,9 @@ NO CHANGE
~~~clojure ~~~clojure
(inferred-types (inferred-types
(defs (defs
(patt @5.1-5.7 (type "I64 -> I64")) (patt @5.1-5.7 (type "Error -> Error"))
(patt @9.1-9.10 (type "Error -> Error"))) (patt @9.1-9.10 (type "Error -> Error")))
(expressions (expressions
(expr @5.10-5.19 (type "I64 -> I64")) (expr @5.10-5.19 (type "Error -> Error"))
(expr @9.13-9.24 (type "Error -> Error")))) (expr @9.13-9.24 (type "Error -> Error"))))
~~~ ~~~

View file

@ -57,7 +57,7 @@ This expression is used in an unexpected way:
^^^^^^^^ ^^^^^^^^
It is of type: It is of type:
_Num(_size), Num(_size2), _arg -> Num(_size3), _arg2 -> Num(_size4) -> _ret_ _Num(_size), Num(_size2), Num(_size3) -> Num(_size4), Num(_size5) -> Num(_size6) -> _ret_
But you are trying to use it as: But you are trying to use it as:
_Pair(a, b), a -> c, b -> d -> Pair(c, d)_ _Pair(a, b), a -> c, b -> d -> Pair(c, d)_

View file

@ -14,20 +14,20 @@ my_number : U64
my_number = add_one(42) my_number = add_one(42)
~~~ ~~~
# EXPECTED # EXPECTED
TYPE MISMATCH - type_anno_connection.md:7:21:7:23 TYPE MISMATCH - type_anno_connection.md:4:19:4:20
# PROBLEMS # PROBLEMS
**TYPE MISMATCH** **TYPE MISMATCH**
The first argument to this function is not what I expect: This expression is used in an unexpected way:
**type_anno_connection.md:7:21:7:23:** **type_anno_connection.md:4:19:4:20:**
```roc ```roc
my_number = add_one(42) add_one = |x| x + 1
``` ```
^^ ^
This argument is of type: It is of type:
_Num(_size)_ _Num(_size)_
But the function needs the first argumument to be: But you are trying to use it as:
_U64_ _U64_
# TOKENS # TOKENS

View file

@ -35,7 +35,7 @@ main! = |_| {
~~~ ~~~
# EXPECTED # EXPECTED
UNUSED VARIABLE - type_annotation_basic.md:21:5:21:9 UNUSED VARIABLE - type_annotation_basic.md:21:5:21:9
TYPE MISMATCH - type_annotation_basic.md:24:21:24:22 TYPE MISMATCH - type_annotation_basic.md:13:18:13:19
# PROBLEMS # PROBLEMS
**UNUSED VARIABLE** **UNUSED VARIABLE**
Variable `pair` is not used anywhere in your code. Variable `pair` is not used anywhere in your code.
@ -50,17 +50,17 @@ The unused variable is declared here:
**TYPE MISMATCH** **TYPE MISMATCH**
The first argument to this function is not what I expect: This expression is used in an unexpected way:
**type_annotation_basic.md:24:21:24:22:** **type_annotation_basic.md:13:18:13:19:**
```roc ```roc
result = addOne(5) addOne = |n| n + 1
``` ```
^ ^
This argument is of type: It is of type:
_Num(_size)_ _Num(_size)_
But the function needs the first argumument to be: But you are trying to use it as:
_U64_ _U64_
# TOKENS # TOKENS
@ -291,11 +291,11 @@ main! = |_| {
(defs (defs
(patt @5.1-5.9 (type "a -> a")) (patt @5.1-5.9 (type "a -> a"))
(patt @9.1-9.8 (type "a, b -> (a, b)")) (patt @9.1-9.8 (type "a, b -> (a, b)"))
(patt @13.1-13.7 (type "U64 -> U64")) (patt @13.1-13.7 (type "Error -> Error"))
(patt @15.1-15.6 (type "_arg -> Error"))) (patt @15.1-15.6 (type "_arg -> Error")))
(expressions (expressions
(expr @5.12-5.17 (type "a -> a")) (expr @5.12-5.17 (type "a -> a"))
(expr @9.11-9.42 (type "a, b -> (a, b)")) (expr @9.11-9.42 (type "a, b -> (a, b)"))
(expr @13.10-13.19 (type "U64 -> U64")) (expr @13.10-13.19 (type "Error -> Error"))
(expr @15.9-27.2 (type "_arg -> Error")))) (expr @15.9-27.2 (type "_arg -> Error"))))
~~~ ~~~

View file

@ -256,12 +256,12 @@ main! = |_| {
(patt @4.1-4.15 (type "_arg -> Num(_size)")) (patt @4.1-4.15 (type "_arg -> Num(_size)"))
(patt @7.1-7.16 (type "_arg -> _ret")) (patt @7.1-7.16 (type "_arg -> _ret"))
(patt @10.1-10.18 (type "_arg -> Num(_size)")) (patt @10.1-10.18 (type "_arg -> Num(_size)"))
(patt @13.1-13.13 (type "_arg -> Num(_size)")) (patt @13.1-13.13 (type "Num(_size) -> Num(_size2)"))
(patt @15.1-15.6 (type "_arg -> Num(_size)"))) (patt @15.1-15.6 (type "_arg -> Num(_size)")))
(expressions (expressions
(expr @4.18-4.24 (type "_arg -> Num(_size)")) (expr @4.18-4.24 (type "_arg -> Num(_size)"))
(expr @7.19-7.34 (type "_arg -> _ret")) (expr @7.19-7.34 (type "_arg -> _ret"))
(expr @10.21-10.35 (type "_arg -> Num(_size)")) (expr @10.21-10.35 (type "_arg -> Num(_size)"))
(expr @13.16-13.35 (type "_arg -> Num(_size)")) (expr @13.16-13.35 (type "Num(_size) -> Num(_size2)"))
(expr @15.9-21.2 (type "_arg -> Num(_size)")))) (expr @15.9-21.2 (type "_arg -> Num(_size)"))))
~~~ ~~~