From 13620be1d42d7cd94f9d32e8249e216b6b433fae Mon Sep 17 00:00:00 2001 From: Wolfgang Grieskamp Date: Thu, 31 Aug 2023 10:26:17 -0700 Subject: [PATCH] Addressing more reviewer comments. This revamps the generation of error messages, removing some older broken heuristics and trying to fix the problem of orientation of 'expected' vs 'found' at the core. Some context annotation 'from assignment context' not tries to clarify the error message if the typing error is for an lvalue, where the expected type is a _lower bound_ instead of an upper bound, which may leads to confusion for end users. The messages are now more systematic but perhaps a bit harder to understand, yet this is not trivial to fix and we have to iterate on this. --- .../naming/generics_shadowing_invalid.exp | 4 +- .../assign_unpack_references_invalid.exp | 20 ++++---- .../checking/typing/assign_wrong_arity.exp | 8 ++-- .../checking/typing/assign_wrong_type.exp | 24 +++++----- .../checking/typing/binary_add_invalid.exp | 36 +++++++------- .../checking/typing/binary_and_invalid.exp | 20 ++++---- .../typing/binary_bit_and_invalid.exp | 36 +++++++------- .../checking/typing/binary_bit_or_invalid.exp | 36 +++++++------- .../typing/binary_bit_xor_invalid.exp | 36 +++++++------- .../checking/typing/binary_div_invalid.exp | 36 +++++++------- .../checking/typing/binary_geq_invalid.exp | 38 +++++++-------- .../checking/typing/binary_gt_invalid.exp | 38 +++++++-------- .../checking/typing/binary_leq_invalid.exp | 38 +++++++-------- .../checking/typing/binary_lt_invalid.exp | 38 +++++++-------- .../checking/typing/binary_mod_invalid.exp | 36 +++++++------- .../checking/typing/binary_mul_invalid.exp | 36 +++++++------- .../checking/typing/binary_or_invalid.exp | 20 ++++---- .../checking/typing/binary_shl_invalid.exp | 36 +++++++------- .../checking/typing/binary_shr_invalid.exp | 36 +++++++------- .../checking/typing/binary_sub_invalid.exp | 36 +++++++------- .../typing/bind_unpack_references_invalid.exp | 20 ++++---- .../checking/typing/bind_wrong_arity.exp | 2 +- .../tests/checking/typing/bind_wrong_type.exp | 8 ++-- .../typing/block_with_statements_invalid.exp | 4 +- .../checking/typing/constant_inference.exp | 6 +-- .../typing/constant_unsupported_exps.exp | 4 +- .../checking/typing/declare_wrong_arity.exp | 2 +- .../checking/typing/derefrence_invalid.exp | 16 +++---- .../tests/checking/typing/eq_invalid.exp | 18 +++---- .../typing/if_mismatched_branches.exp | 28 +++++------ .../tests/checking/typing/lambda.exp | 14 +++--- .../checking/typing/loop_body_invalid.exp | 4 +- .../typing/loop_result_type_invalid.exp | 4 +- ...e_call_explicit_type_arguments_invalid.exp | 12 ++--- .../module_call_wrong_argument_in_list.exp | 48 +++++++++---------- .../module_call_wrong_single_argument.exp | 20 ++++---- .../tests/checking/typing/mutate_non_ref.exp | 6 +-- .../tests/checking/typing/neq_invalid.exp | 18 +++---- .../typing/other_builtins_invalid.exp | 8 ++-- .../tests/checking/typing/recursive_local.exp | 2 +- .../typing/shadowing_invalid_types.exp | 18 +++---- .../checking/typing/subtype_args_invalid.exp | 20 ++++---- .../typing/subtype_assign_invalid.exp | 8 ++-- ...type_variable_join_single_pack_invalid.exp | 6 +-- ...pe_variable_join_threaded_pack_invalid.exp | 6 +-- ...le_join_threaded_unpack_assign_invalid.exp | 6 +-- ..._variable_join_threaded_unpack_invalid.exp | 6 +-- .../checking/typing/unary_not_invalid.exp | 24 +++++----- .../typing/vector_mismatched_args.exp | 12 ++--- .../checking/typing/while_body_invalid.exp | 4 +- .../move-model/src/builder/exp_builder.rs | 16 +++++-- third_party/move/move-model/src/ty.rs | 48 +++++++++++++------ .../tests/sources/expressions_err.exp | 6 +-- .../tests/sources/use_erroneous_schema.exp | 4 +- 54 files changed, 532 insertions(+), 504 deletions(-) diff --git a/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing_invalid.exp index ced6324d48e12..bb93a8c871eec 100644 --- a/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/naming/generics_shadowing_invalid.exp @@ -13,10 +13,10 @@ error: expected `S` but found `M::S` │ ^^^^ error: invalid call of `M::bar`: expected `M::S` but found `S` for argument 1 - ┌─ tests/checking/naming/generics_shadowing_invalid.move:9:9 + ┌─ tests/checking/naming/generics_shadowing_invalid.move:9:13 │ 9 │ bar(s1); - │ ^^^^^^^ + │ ^^ error: expected `S` but found `M::S` ┌─ tests/checking/naming/generics_shadowing_invalid.move:10:9 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references_invalid.exp index 480ca48393edc..08203b7979bf3 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_unpack_references_invalid.exp @@ -1,36 +1,36 @@ Diagnostics: -error: expected `&u64` but found `integer` - ┌─ tests/checking/typing/assign_unpack_references_invalid.move:9:13 +error: expected `&u64` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/assign_unpack_references_invalid.move:9:9 │ 9 │ f = 0; - │ ^ + │ ^ -error: expected `&M::S` but found `M::S` +error: expected `&M::S` but found `M::S` (from assignment or declaration context) ┌─ tests/checking/typing/assign_unpack_references_invalid.move:10:9 │ 10 │ s2 = S { f: 0 } │ ^^ -error: expected `&mut u64` but found `integer` - ┌─ tests/checking/typing/assign_unpack_references_invalid.move:17:13 +error: expected `&mut u64` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/assign_unpack_references_invalid.move:17:9 │ 17 │ f = 0; - │ ^ + │ ^ -error: expected `&mut M::S` but found `M::S` +error: expected `&mut M::S` but found `M::S` (from assignment or declaration context) ┌─ tests/checking/typing/assign_unpack_references_invalid.move:18:9 │ 18 │ s2 = S { f: 0 } │ ^^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/assign_unpack_references_invalid.move:26:9 │ 26 │ f = &0; │ ^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/assign_unpack_references_invalid.move:27:9 │ 27 │ s2 = &S { f: 0 } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_arity.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_arity.exp index 8d4582fcc6fc4..65d6f3f0d553d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_arity.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_arity.exp @@ -1,16 +1,16 @@ Diagnostics: -error: tuples have different arity (0 != 3) +error: tuples have different arity (0 != 3) (from assignment or declaration context) ┌─ tests/checking/typing/assign_wrong_arity.move:7:9 │ 7 │ x = (0, 1, 2); │ ^ -error: expected `()` but found `integer` - ┌─ tests/checking/typing/assign_wrong_arity.move:8:14 +error: expected `()` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/assign_wrong_arity.move:8:9 │ 8 │ () = 0; - │ ^ + │ ^^ error: expected 4 item(s), found 3 ┌─ tests/checking/typing/assign_wrong_arity.move:11:9 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_type.exp index b13520ac0ef83..c37b75c8f7cd9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_type.exp @@ -12,11 +12,11 @@ error: expected `M::S` but found `M::R` 9 │ (S { g }, R { f }) = (R{ f: 0 }, R{ f: 1 }); │ ^^^^^^^ -error: expected `()` but found `integer` - ┌─ tests/checking/typing/assign_wrong_type.move:17:14 +error: expected `()` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/assign_wrong_type.move:17:9 │ 17 │ () = 0; - │ ^ + │ ^^ error: expected 4 item(s), found 3 ┌─ tests/checking/typing/assign_wrong_type.move:18:9 @@ -30,25 +30,25 @@ error: expected 2 item(s), found 3 19 │ (x, b, R{f}) = (0, false); │ ^^^^^^^^^^^^ -error: expected `bool` but found `integer` - ┌─ tests/checking/typing/assign_wrong_type.move:27:28 +error: expected `bool` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/assign_wrong_type.move:27:10 │ 27 │ (x, b, R{f}, r) = (0, false, R{f: 0}, R{f: 0}); - │ ^ + │ ^ -error: expected `bool` but found `integer` - ┌─ tests/checking/typing/assign_wrong_type.move:24:17 +error: expected `integer` but found `bool` (from assignment or declaration context) + ┌─ tests/checking/typing/assign_wrong_type.move:27:13 │ -24 │ let b = 0; - │ ^ +27 │ (x, b, R{f}, r) = (0, false, R{f: 0}, R{f: 0}); + │ ^ -error: expected `address` but found `u64` +error: expected `address` but found `u64` (from assignment or declaration context) ┌─ tests/checking/typing/assign_wrong_type.move:27:18 │ 27 │ (x, b, R{f}, r) = (0, false, R{f: 0}, R{f: 0}); │ ^ -error: expected `M::S` but found `M::R` +error: expected `M::S` but found `M::R` (from assignment or declaration context) ┌─ tests/checking/typing/assign_wrong_type.move:27:22 │ 27 │ (x, b, R{f}, r) = (0, false, R{f: 0}, R{f: 0}); diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_add_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_add_invalid.exp index a926487b181bb..a720fb291dcc8 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_add_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_add_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `+`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:8:9 │ 8 │ false + true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `+`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_add_invalid.move:9:9 + ┌─ tests/checking/typing/binary_add_invalid.move:9:13 │ 9 │ 1 + false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `+`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:10:9 │ 10 │ false + 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `+`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:11:9 │ 11 │ @0x0 + @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `+`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_add_invalid.move:12:9 + ┌─ tests/checking/typing/binary_add_invalid.move:12:20 │ 12 │ (0: u8) + (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `+`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:13:9 │ 13 │ r + r; - │ ^^^^^ + │ ^ error: invalid call of `+`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:14:9 │ 14 │ s + s; - │ ^^^^^ + │ ^ error: invalid call of `+`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_add_invalid.move:15:9 + ┌─ tests/checking/typing/binary_add_invalid.move:15:13 │ 15 │ 1 + false + @0x0 + 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `+`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_add_invalid.move:15:9 + ┌─ tests/checking/typing/binary_add_invalid.move:15:21 │ 15 │ 1 + false + @0x0 + 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `+`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:16:9 │ 16 │ () + (); - │ ^^^^^^^ + │ ^^ error: invalid call of `+`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_add_invalid.move:17:9 + ┌─ tests/checking/typing/binary_add_invalid.move:17:13 │ 17 │ 1 + (); - │ ^^^^^^ + │ ^^ error: invalid call of `+`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:18:9 │ 18 │ (0, 1) + (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `+`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:19:9 │ 19 │ (1, 2) + (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_and_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_and_invalid.exp index 5a000d9ec68a2..6b6383466e3d5 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_and_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_and_invalid.exp @@ -22,46 +22,46 @@ error: invalid call of `&&`: expected `bool` but found `address` for argument 1 ┌─ tests/checking/typing/binary_and_invalid.move:11:9 │ 11 │ @0x0 && @0x1; - │ ^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `&&`: expected `bool` but found `u8` for argument 1 - ┌─ tests/checking/typing/binary_and_invalid.move:12:9 + ┌─ tests/checking/typing/binary_and_invalid.move:12:10 │ 12 │ (0: u8) && (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `&&`: expected `bool` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_and_invalid.move:13:9 │ 13 │ r && r; - │ ^^^^^^ + │ ^ error: invalid call of `&&`: expected `bool` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_and_invalid.move:14:9 │ 14 │ s && s; - │ ^^^^^^ + │ ^ error: invalid call of `&&`: expected `bool` but found `()` for argument 1 ┌─ tests/checking/typing/binary_and_invalid.move:15:9 │ 15 │ () && (); - │ ^^^^^^^^ + │ ^^ error: invalid call of `&&`: expected `bool` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_and_invalid.move:16:9 + ┌─ tests/checking/typing/binary_and_invalid.move:16:17 │ 16 │ true && (); - │ ^^^^^^^^^^ + │ ^^ error: invalid call of `&&`: expected `bool` but found `(bool, bool)` for argument 1 ┌─ tests/checking/typing/binary_and_invalid.move:17:9 │ 17 │ (true, false) && (true, false, true); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^^^^^ error: invalid call of `&&`: expected `bool` but found `(bool, bool)` for argument 1 ┌─ tests/checking/typing/binary_and_invalid.move:18:9 │ 18 │ (true, true) && (false, false); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and_invalid.exp index 6bf3172340872..8b67b9c8d3d2c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `&`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:8:9 │ 8 │ false & true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `&`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_bit_and_invalid.move:9:9 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:9:13 │ 9 │ 1 & false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `&`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:10:9 │ 10 │ false & 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `&`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:11:9 │ 11 │ @0x0 & @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `&`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_bit_and_invalid.move:12:9 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:12:20 │ 12 │ (0: u8) & (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `&`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:13:9 │ 13 │ r & r; - │ ^^^^^ + │ ^ error: invalid call of `&`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:14:9 │ 14 │ s & s; - │ ^^^^^ + │ ^ error: invalid call of `&`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:9 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:13 │ 15 │ 1 & false & @0x0 & 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `&`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:9 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:21 │ 15 │ 1 & false & @0x0 & 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `&`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:16:9 │ 16 │ () & (); - │ ^^^^^^^ + │ ^^ error: invalid call of `&`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_bit_and_invalid.move:17:9 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:17:13 │ 17 │ 1 & (); - │ ^^^^^^ + │ ^^ error: invalid call of `&`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:18:9 │ 18 │ (0, 1) & (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `&`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:19:9 │ 19 │ (1, 2) & (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or_invalid.exp index 88256709df607..535b108f23693 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `|`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:8:9 │ 8 │ false | true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `|`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_bit_or_invalid.move:9:9 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:9:13 │ 9 │ 1 | false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `|`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:10:9 │ 10 │ false | 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `|`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:11:9 │ 11 │ @0x0 | @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `|`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_bit_or_invalid.move:12:9 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:12:20 │ 12 │ (0: u8) | (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `|`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:13:9 │ 13 │ r | r; - │ ^^^^^ + │ ^ error: invalid call of `|`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:14:9 │ 14 │ s | s; - │ ^^^^^ + │ ^ error: invalid call of `|`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:9 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:13 │ 15 │ 1 | false | @0x0 | 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `|`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:9 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:21 │ 15 │ 1 | false | @0x0 | 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `|`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:16:9 │ 16 │ () | (); - │ ^^^^^^^ + │ ^^ error: invalid call of `|`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_bit_or_invalid.move:17:9 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:17:13 │ 17 │ 1 | (); - │ ^^^^^^ + │ ^^ error: invalid call of `|`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:18:9 │ 18 │ (0, 1) | (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `|`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:19:9 │ 19 │ (1, 2) | (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_xor_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_xor_invalid.exp index 594cc6a28222c..6feb394e0de53 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_xor_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_xor_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `^`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:8:9 │ 8 │ false ^ true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `^`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:9:9 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:9:13 │ 9 │ 1 ^ false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `^`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:10:9 │ 10 │ false ^ 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `^`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:11:9 │ 11 │ @0x0 ^ @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `^`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:12:9 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:12:20 │ 12 │ (0: u8) ^ (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `^`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:13:9 │ 13 │ r ^ r; - │ ^^^^^ + │ ^ error: invalid call of `^`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:14:9 │ 14 │ s ^ s; - │ ^^^^^ + │ ^ error: invalid call of `^`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:9 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:13 │ 15 │ 1 ^ false ^ @0x0 ^ 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `^`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:9 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:21 │ 15 │ 1 ^ false ^ @0x0 ^ 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `^`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:16:9 │ 16 │ () ^ (); - │ ^^^^^^^ + │ ^^ error: invalid call of `^`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:17:9 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:17:13 │ 17 │ 1 ^ (); - │ ^^^^^^ + │ ^^ error: invalid call of `^`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:18:9 │ 18 │ (0, 1) ^ (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `^`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:19:9 │ 19 │ (1, 2) ^ (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_div_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_div_invalid.exp index c0b5fdabe856d..5ed5cc330621d 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_div_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_div_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `/`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:8:9 │ 8 │ false / true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `/`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_div_invalid.move:9:9 + ┌─ tests/checking/typing/binary_div_invalid.move:9:13 │ 9 │ 1 / false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `/`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:10:9 │ 10 │ false / 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `/`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:11:9 │ 11 │ @0x0 / @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `/`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_div_invalid.move:12:9 + ┌─ tests/checking/typing/binary_div_invalid.move:12:20 │ 12 │ (0: u8) / (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `/`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:13:9 │ 13 │ r / r; - │ ^^^^^ + │ ^ error: invalid call of `/`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:14:9 │ 14 │ s / s; - │ ^^^^^ + │ ^ error: invalid call of `/`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_div_invalid.move:15:9 + ┌─ tests/checking/typing/binary_div_invalid.move:15:13 │ 15 │ 1 / false / @0x0 / 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `/`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_div_invalid.move:15:9 + ┌─ tests/checking/typing/binary_div_invalid.move:15:21 │ 15 │ 1 / false / @0x0 / 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `/`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:16:9 │ 16 │ () / (); - │ ^^^^^^^ + │ ^^ error: invalid call of `/`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_div_invalid.move:17:9 + ┌─ tests/checking/typing/binary_div_invalid.move:17:13 │ 17 │ 1 / (); - │ ^^^^^^ + │ ^^ error: invalid call of `/`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:18:9 │ 18 │ (0, 1) / (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `/`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:19:9 │ 19 │ (1, 2) / (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq_invalid.exp index fca773b9faecd..0636ba5474efe 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq_invalid.exp @@ -4,82 +4,82 @@ error: invalid call of `>=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:8:9 │ 8 │ false >= true; - │ ^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>=`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_geq_invalid.move:9:9 + ┌─ tests/checking/typing/binary_geq_invalid.move:9:14 │ 9 │ 1 >= false; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:10:9 │ 10 │ false >= 1; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>=`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:11:9 │ 11 │ @0x0 >= @0x1; - │ ^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `>=`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_geq_invalid.move:12:9 + ┌─ tests/checking/typing/binary_geq_invalid.move:12:21 │ 12 │ (0: u8) >= (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `>=`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:13:9 │ 13 │ r >= r; - │ ^^^^^^ + │ ^ error: invalid call of `>=`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:14:9 │ 14 │ s >= s; - │ ^^^^^^ + │ ^ error: invalid call of `>=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:15:9 │ 15 │ 0 >= 1 >= 2; - │ ^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `>=`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_geq_invalid.move:16:9 + ┌─ tests/checking/typing/binary_geq_invalid.move:16:15 │ 16 │ (1 >= false) && (@0x0 >= 0); - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>=`: expected `integer` but found `address` for argument 1 - ┌─ tests/checking/typing/binary_geq_invalid.move:16:25 + ┌─ tests/checking/typing/binary_geq_invalid.move:16:26 │ 16 │ (1 >= false) && (@0x0 >= 0); - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `>=`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:17:9 │ 17 │ () >= (); - │ ^^^^^^^^ + │ ^^ error: invalid call of `>=`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_geq_invalid.move:18:9 + ┌─ tests/checking/typing/binary_geq_invalid.move:18:14 │ 18 │ 1 >= (); - │ ^^^^^^^ + │ ^^ error: invalid call of `>=`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:19:9 │ 19 │ (0, 1) >= (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `>=`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:20:9 │ 20 │ (1, 2) >= (0, 1); - │ ^^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt_invalid.exp index 9aa648ae898a9..414adb6afd7d0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt_invalid.exp @@ -4,82 +4,82 @@ error: invalid call of `>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:8:9 │ 8 │ false > true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_gt_invalid.move:9:9 + ┌─ tests/checking/typing/binary_gt_invalid.move:9:13 │ 9 │ 1 > false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:10:9 │ 10 │ false > 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `>`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:11:9 │ 11 │ @0x0 > @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `>`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_gt_invalid.move:12:9 + ┌─ tests/checking/typing/binary_gt_invalid.move:12:20 │ 12 │ (0: u8) > (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `>`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:13:9 │ 13 │ r > r; - │ ^^^^^ + │ ^ error: invalid call of `>`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:14:9 │ 14 │ s > s; - │ ^^^^^ + │ ^ error: invalid call of `>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:15:9 │ 15 │ 0 > 1 > 2; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `>`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_gt_invalid.move:16:9 + ┌─ tests/checking/typing/binary_gt_invalid.move:16:14 │ 16 │ (1 > false) && (@0x0 > 0); - │ ^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>`: expected `integer` but found `address` for argument 1 - ┌─ tests/checking/typing/binary_gt_invalid.move:16:24 + ┌─ tests/checking/typing/binary_gt_invalid.move:16:25 │ 16 │ (1 > false) && (@0x0 > 0); - │ ^^^^^^^^^^ + │ ^^^^ error: invalid call of `>`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:17:9 │ 17 │ () > (); - │ ^^^^^^^ + │ ^^ error: invalid call of `>`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_gt_invalid.move:18:9 + ┌─ tests/checking/typing/binary_gt_invalid.move:18:13 │ 18 │ 1 > (); - │ ^^^^^^ + │ ^^ error: invalid call of `>`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:19:9 │ 19 │ (0, 1) > (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `>`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:20:9 │ 20 │ (1, 2) > (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq_invalid.exp index 365cdfe804012..8a0e09ec7830b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq_invalid.exp @@ -4,82 +4,82 @@ error: invalid call of `<=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:8:9 │ 8 │ false <= true; - │ ^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<=`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_leq_invalid.move:9:9 + ┌─ tests/checking/typing/binary_leq_invalid.move:9:14 │ 9 │ 1 <= false; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:10:9 │ 10 │ false <= 1; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<=`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:11:9 │ 11 │ @0x0 <= @0x1; - │ ^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `<=`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_leq_invalid.move:12:9 + ┌─ tests/checking/typing/binary_leq_invalid.move:12:21 │ 12 │ (0: u8) <= (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `<=`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:13:9 │ 13 │ r <= r; - │ ^^^^^^ + │ ^ error: invalid call of `<=`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:14:9 │ 14 │ s <= s; - │ ^^^^^^ + │ ^ error: invalid call of `<=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:15:9 │ 15 │ 0 <= 1 <= 2; - │ ^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `<=`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_leq_invalid.move:16:9 + ┌─ tests/checking/typing/binary_leq_invalid.move:16:15 │ 16 │ (1 <= false) && (@0x0 <= 0); - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<=`: expected `integer` but found `address` for argument 1 - ┌─ tests/checking/typing/binary_leq_invalid.move:16:25 + ┌─ tests/checking/typing/binary_leq_invalid.move:16:26 │ 16 │ (1 <= false) && (@0x0 <= 0); - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `<=`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:17:9 │ 17 │ () <= (); - │ ^^^^^^^^ + │ ^^ error: invalid call of `<=`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_leq_invalid.move:18:9 + ┌─ tests/checking/typing/binary_leq_invalid.move:18:14 │ 18 │ 1 <= (); - │ ^^^^^^^ + │ ^^ error: invalid call of `<=`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:19:9 │ 19 │ (0, 1) <= (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `<=`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:20:9 │ 20 │ (1, 2) <= (0, 1); - │ ^^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt_invalid.exp index 134c77255139f..e97f23a1660e4 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt_invalid.exp @@ -4,82 +4,82 @@ error: invalid call of `<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:8:9 │ 8 │ false < true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_lt_invalid.move:9:9 + ┌─ tests/checking/typing/binary_lt_invalid.move:9:13 │ 9 │ 1 < false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:10:9 │ 10 │ false < 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `<`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:11:9 │ 11 │ @0x0 < @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `<`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_lt_invalid.move:12:9 + ┌─ tests/checking/typing/binary_lt_invalid.move:12:20 │ 12 │ (0: u8) < (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `<`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:13:9 │ 13 │ r < r; - │ ^^^^^ + │ ^ error: invalid call of `<`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:14:9 │ 14 │ s < s; - │ ^^^^^ + │ ^ error: invalid call of `<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:15:9 │ 15 │ 0 < 1 < 2; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `<`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_lt_invalid.move:16:9 + ┌─ tests/checking/typing/binary_lt_invalid.move:16:14 │ 16 │ (1 < false) && (@0x0 < 0); - │ ^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<`: expected `integer` but found `address` for argument 1 - ┌─ tests/checking/typing/binary_lt_invalid.move:16:24 + ┌─ tests/checking/typing/binary_lt_invalid.move:16:25 │ 16 │ (1 < false) && (@0x0 < 0); - │ ^^^^^^^^^^ + │ ^^^^ error: invalid call of `<`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:17:9 │ 17 │ () < (); - │ ^^^^^^^ + │ ^^ error: invalid call of `<`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_lt_invalid.move:18:9 + ┌─ tests/checking/typing/binary_lt_invalid.move:18:13 │ 18 │ 1 < (); - │ ^^^^^^ + │ ^^ error: invalid call of `<`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:19:9 │ 19 │ (0, 1) < (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `<`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:20:9 │ 20 │ (1, 2) < (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod_invalid.exp index 060bf82fcebc7..7f7bf75271de0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `%`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:8:9 │ 8 │ false % true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `%`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_mod_invalid.move:9:9 + ┌─ tests/checking/typing/binary_mod_invalid.move:9:13 │ 9 │ 1 % false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `%`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:10:9 │ 10 │ false % 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `%`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:11:9 │ 11 │ @0x0 % @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `%`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_mod_invalid.move:12:9 + ┌─ tests/checking/typing/binary_mod_invalid.move:12:20 │ 12 │ (0: u8) % (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `%`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:13:9 │ 13 │ r % r; - │ ^^^^^ + │ ^ error: invalid call of `%`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:14:9 │ 14 │ s % s; - │ ^^^^^ + │ ^ error: invalid call of `%`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_mod_invalid.move:15:9 + ┌─ tests/checking/typing/binary_mod_invalid.move:15:13 │ 15 │ 1 % false % @0x0 % 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `%`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_mod_invalid.move:15:9 + ┌─ tests/checking/typing/binary_mod_invalid.move:15:21 │ 15 │ 1 % false % @0x0 % 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `%`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:16:9 │ 16 │ () % (); - │ ^^^^^^^ + │ ^^ error: invalid call of `%`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_mod_invalid.move:17:9 + ┌─ tests/checking/typing/binary_mod_invalid.move:17:13 │ 17 │ 1 % (); - │ ^^^^^^ + │ ^^ error: invalid call of `%`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:18:9 │ 18 │ (0, 1) % (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `%`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:19:9 │ 19 │ (1, 2) % (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul_invalid.exp index ce478b1ba408e..d857ca796a5ab 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `*`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:8:9 │ 8 │ false * true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `*`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_mul_invalid.move:9:9 + ┌─ tests/checking/typing/binary_mul_invalid.move:9:13 │ 9 │ 1 * false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `*`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:10:9 │ 10 │ false * 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `*`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:11:9 │ 11 │ @0x0 * @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `*`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_mul_invalid.move:12:9 + ┌─ tests/checking/typing/binary_mul_invalid.move:12:20 │ 12 │ (0: u8) * (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `*`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:13:9 │ 13 │ r * r; - │ ^^^^^ + │ ^ error: invalid call of `*`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:14:9 │ 14 │ s * s; - │ ^^^^^ + │ ^ error: invalid call of `*`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_mul_invalid.move:15:9 + ┌─ tests/checking/typing/binary_mul_invalid.move:15:13 │ 15 │ 1 * false * @0x0 * 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `*`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_mul_invalid.move:15:9 + ┌─ tests/checking/typing/binary_mul_invalid.move:15:21 │ 15 │ 1 * false * @0x0 * 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `*`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:16:9 │ 16 │ () * (); - │ ^^^^^^^ + │ ^^ error: invalid call of `*`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_mul_invalid.move:17:9 + ┌─ tests/checking/typing/binary_mul_invalid.move:17:13 │ 17 │ 1 * (); - │ ^^^^^^ + │ ^^ error: invalid call of `*`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:18:9 │ 18 │ (0, 1) * (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `*`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:19:9 │ 19 │ (1, 2) * (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_or_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_or_invalid.exp index d6d422b42e743..9e704a594b363 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_or_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_or_invalid.exp @@ -22,46 +22,46 @@ error: invalid call of `||`: expected `bool` but found `address` for argument 1 ┌─ tests/checking/typing/binary_or_invalid.move:11:9 │ 11 │ @0x0 || @0x1; - │ ^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `||`: expected `bool` but found `u8` for argument 1 - ┌─ tests/checking/typing/binary_or_invalid.move:12:9 + ┌─ tests/checking/typing/binary_or_invalid.move:12:10 │ 12 │ (0: u8) || (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `||`: expected `bool` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_or_invalid.move:13:9 │ 13 │ r || r; - │ ^^^^^^ + │ ^ error: invalid call of `||`: expected `bool` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_or_invalid.move:14:9 │ 14 │ s || s; - │ ^^^^^^ + │ ^ error: invalid call of `||`: expected `bool` but found `()` for argument 1 ┌─ tests/checking/typing/binary_or_invalid.move:15:9 │ 15 │ () || (); - │ ^^^^^^^^ + │ ^^ error: invalid call of `||`: expected `bool` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_or_invalid.move:16:9 + ┌─ tests/checking/typing/binary_or_invalid.move:16:17 │ 16 │ true || (); - │ ^^^^^^^^^^ + │ ^^ error: invalid call of `||`: expected `bool` but found `(bool, bool)` for argument 1 ┌─ tests/checking/typing/binary_or_invalid.move:17:9 │ 17 │ (true, false) || (true, false, true); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^^^^^ error: invalid call of `||`: expected `bool` but found `(bool, bool)` for argument 1 ┌─ tests/checking/typing/binary_or_invalid.move:18:9 │ 18 │ (true, true) || (false, false); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl_invalid.exp index ac0805cc06c01..537f91d201e90 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `<<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:8:9 │ 8 │ false << true; - │ ^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<<`: expected `u8` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_shl_invalid.move:9:9 + ┌─ tests/checking/typing/binary_shl_invalid.move:9:14 │ 9 │ 1 << false; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:10:9 │ 10 │ false << 1; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<<`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:11:9 │ 11 │ @0x0 << @0x1; - │ ^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `<<`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_shl_invalid.move:12:9 + ┌─ tests/checking/typing/binary_shl_invalid.move:12:21 │ 12 │ (0: u8) << (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `<<`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:13:9 │ 13 │ r << r; - │ ^^^^^^ + │ ^ error: invalid call of `<<`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:14:9 │ 14 │ s << s; - │ ^^^^^^ + │ ^ error: invalid call of `<<`: expected `u8` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_shl_invalid.move:15:9 + ┌─ tests/checking/typing/binary_shl_invalid.move:15:14 │ 15 │ 1 << false << @0x0 << 0; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `<<`: expected `u8` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_shl_invalid.move:15:9 + ┌─ tests/checking/typing/binary_shl_invalid.move:15:23 │ 15 │ 1 << false << @0x0 << 0; - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `<<`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:16:9 │ 16 │ () << (); - │ ^^^^^^^^ + │ ^^ error: invalid call of `<<`: expected `u8` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_shl_invalid.move:17:9 + ┌─ tests/checking/typing/binary_shl_invalid.move:17:14 │ 17 │ 1 << (); - │ ^^^^^^^ + │ ^^ error: invalid call of `<<`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:18:9 │ 18 │ (0, 1) << (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `<<`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:19:9 │ 19 │ (1, 2) << (0, 1); - │ ^^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr_invalid.exp index abbef9d132593..02a01e0f0fa4c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `>>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:8:9 │ 8 │ false >> true; - │ ^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>>`: expected `u8` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_shr_invalid.move:9:9 + ┌─ tests/checking/typing/binary_shr_invalid.move:9:14 │ 9 │ 1 >> false; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:10:9 │ 10 │ false >> 1; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>>`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:11:9 │ 11 │ @0x0 >> @0x1; - │ ^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `>>`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_shr_invalid.move:12:9 + ┌─ tests/checking/typing/binary_shr_invalid.move:12:21 │ 12 │ (0: u8) >> (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `>>`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:13:9 │ 13 │ r >> r; - │ ^^^^^^ + │ ^ error: invalid call of `>>`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:14:9 │ 14 │ s >> s; - │ ^^^^^^ + │ ^ error: invalid call of `>>`: expected `u8` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_shr_invalid.move:15:9 + ┌─ tests/checking/typing/binary_shr_invalid.move:15:14 │ 15 │ 1 >> false >> @0x0 >> 0; - │ ^^^^^^^^^^ + │ ^^^^^ error: invalid call of `>>`: expected `u8` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_shr_invalid.move:15:9 + ┌─ tests/checking/typing/binary_shr_invalid.move:15:23 │ 15 │ 1 >> false >> @0x0 >> 0; - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `>>`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:16:9 │ 16 │ () >> (); - │ ^^^^^^^^ + │ ^^ error: invalid call of `>>`: expected `u8` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_shr_invalid.move:17:9 + ┌─ tests/checking/typing/binary_shr_invalid.move:17:14 │ 17 │ 1 >> (); - │ ^^^^^^^ + │ ^^ error: invalid call of `>>`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:18:9 │ 18 │ (0, 1) >> (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `>>`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:19:9 │ 19 │ (1, 2) >> (0, 1); - │ ^^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub_invalid.exp index 9fe49e3155aa3..b749f5d8c85ad 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub_invalid.exp @@ -4,76 +4,76 @@ error: invalid call of `-`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:8:9 │ 8 │ false - true; - │ ^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `-`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_sub_invalid.move:9:9 + ┌─ tests/checking/typing/binary_sub_invalid.move:9:13 │ 9 │ 1 - false; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `-`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:10:9 │ 10 │ false - 1; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `-`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:11:9 │ 11 │ @0x0 - @0x1; - │ ^^^^^^^^^^^ + │ ^^^^ error: invalid call of `-`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/binary_sub_invalid.move:12:9 + ┌─ tests/checking/typing/binary_sub_invalid.move:12:20 │ 12 │ (0: u8) - (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `-`: expected `integer` but found `M::R` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:13:9 │ 13 │ r - r; - │ ^^^^^ + │ ^ error: invalid call of `-`: expected `integer` but found `M::S` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:14:9 │ 14 │ s - s; - │ ^^^^^ + │ ^ error: invalid call of `-`: expected `integer` but found `bool` for argument 2 - ┌─ tests/checking/typing/binary_sub_invalid.move:15:9 + ┌─ tests/checking/typing/binary_sub_invalid.move:15:13 │ 15 │ 1 - false - @0x0 - 0; - │ ^^^^^^^^^ + │ ^^^^^ error: invalid call of `-`: expected `integer` but found `address` for argument 2 - ┌─ tests/checking/typing/binary_sub_invalid.move:15:9 + ┌─ tests/checking/typing/binary_sub_invalid.move:15:21 │ 15 │ 1 - false - @0x0 - 0; - │ ^^^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `-`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:16:9 │ 16 │ () - (); - │ ^^^^^^^ + │ ^^ error: invalid call of `-`: expected `integer` but found `()` for argument 2 - ┌─ tests/checking/typing/binary_sub_invalid.move:17:9 + ┌─ tests/checking/typing/binary_sub_invalid.move:17:13 │ 17 │ 1 - (); - │ ^^^^^^ + │ ^^ error: invalid call of `-`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:18:9 │ 18 │ (0, 1) - (0, 1, 2); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `-`: expected `integer` but found `(integer, integer)` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:19:9 │ 19 │ (1, 2) - (0, 1); - │ ^^^^^^^^^^^^^^^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references_invalid.exp index 436d548af5639..702fb1ba9c40a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/bind_unpack_references_invalid.exp @@ -1,36 +1,36 @@ Diagnostics: -error: expected `&u64` but found `integer` - ┌─ tests/checking/typing/bind_unpack_references_invalid.move:7:13 +error: expected `&u64` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/bind_unpack_references_invalid.move:7:9 │ 7 │ f = 0; - │ ^ + │ ^ -error: expected `&M::S` but found `M::S` +error: expected `&M::S` but found `M::S` (from assignment or declaration context) ┌─ tests/checking/typing/bind_unpack_references_invalid.move:8:9 │ 8 │ s2 = S { f: 0 } │ ^^ -error: expected `&mut u64` but found `integer` - ┌─ tests/checking/typing/bind_unpack_references_invalid.move:13:13 +error: expected `&mut u64` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/bind_unpack_references_invalid.move:13:9 │ 13 │ f = 0; - │ ^ + │ ^ -error: expected `&mut M::S` but found `M::S` +error: expected `&mut M::S` but found `M::S` (from assignment or declaration context) ┌─ tests/checking/typing/bind_unpack_references_invalid.move:14:9 │ 14 │ s2 = S { f: 0 } │ ^^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/bind_unpack_references_invalid.move:20:9 │ 20 │ f = &0; │ ^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/bind_unpack_references_invalid.move:21:9 │ 21 │ s2 = &S { f: 0 } diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_arity.exp b/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_arity.exp index d5f49ca9017a4..aa4de0f6a5d4e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_arity.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_arity.exp @@ -1,6 +1,6 @@ Diagnostics: -error: expected `()` but found `u64` +error: expected `()` but found `u64` (from assignment or declaration context) ┌─ tests/checking/typing/bind_wrong_arity.move:6:13 │ 6 │ let (): u64 = 0; diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_type.exp index 18c2fc4c692d6..29941dc482138 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/bind_wrong_type.exp @@ -12,11 +12,11 @@ error: expected `M::S` but found `M::R` 7 │ let (S { g }, R { f }) = (R{ f: 0 }, R{ f: 1 }); │ ^^^^^^^ -error: expected `()` but found `integer` - ┌─ tests/checking/typing/bind_wrong_type.move:12:18 +error: expected `()` but found `integer` (from assignment or declaration context) + ┌─ tests/checking/typing/bind_wrong_type.move:12:13 │ 12 │ let () = 0; - │ ^ + │ ^^ error: expected 4 item(s), found 3 ┌─ tests/checking/typing/bind_wrong_type.move:13:13 @@ -42,7 +42,7 @@ error: expected `u64` but found `()` 19 │ let (): u64 = (); │ ^^ -error: expected `()` but found `u64` +error: expected `()` but found `u64` (from assignment or declaration context) ┌─ tests/checking/typing/bind_wrong_type.move:19:13 │ 19 │ let (): u64 = (); diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid.exp index 455c7608ad258..ed2e5fcb1dec0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements_invalid.exp @@ -1,10 +1,10 @@ Diagnostics: error: expected `bool` but found `integer` - ┌─ tests/checking/typing/block_with_statements_invalid.move:4:20 + ┌─ tests/checking/typing/block_with_statements_invalid.move:4:23 │ 4 │ ({ let x = 0; x } : bool); - │ ^ + │ ^ error: expected `u64` but found `&?6` ┌─ tests/checking/typing/block_with_statements_invalid.move:5:23 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.exp b/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.exp index c72b32dbbecd8..24810aff45ca9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.exp @@ -1,7 +1,7 @@ Diagnostics: -error: invalid call of `+`: expected `u8` but found `u16|u32|u64|u128|u256` for argument 2 - ┌─ tests/checking/typing/constant_inference.move:19:21 +error: invalid call of `+`: expected `u16|u32|u64|u128|u256` but found `u8` for argument 2 + ┌─ tests/checking/typing/constant_inference.move:19:27 │ 19 │ let error = 257 + r; // Should error - │ ^^^ + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/constant_unsupported_exps.exp b/third_party/move/move-compiler-v2/tests/checking/typing/constant_unsupported_exps.exp index 4f628a1dde881..2d7452f96e6e0 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/constant_unsupported_exps.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_unsupported_exps.exp @@ -31,10 +31,10 @@ error: no function named `X::f_private` found │ ^^^^^^^^^^^^^^^^^^^^ error: invalid call of `move_to`: expected `&signer` but found `signer` for argument 1 - ┌─ tests/checking/typing/constant_unsupported_exps.move:30:9 + ┌─ tests/checking/typing/constant_unsupported_exps.move:30:17 │ 30 │ move_to(s, R{}); - │ ^^^^^^^^^^^^^^^ + │ ^ error: The type argument to `exists` and `global` must be a struct type but `?25` is not ┌─ tests/checking/typing/constant_unsupported_exps.move:31:15 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/declare_wrong_arity.exp b/third_party/move/move-compiler-v2/tests/checking/typing/declare_wrong_arity.exp index 385b88c412c79..48f0a5aaaffca 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/declare_wrong_arity.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/declare_wrong_arity.exp @@ -1,6 +1,6 @@ Diagnostics: -error: expected `u64` but found `()` +error: expected `u64` but found `()` (from assignment or declaration context) ┌─ tests/checking/typing/declare_wrong_arity.move:6:13 │ 6 │ let (): u64; diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_invalid.exp index a733afd71eeeb..3a8e713b0987c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/derefrence_invalid.exp @@ -1,22 +1,22 @@ Diagnostics: error: expected `bool` but found `u64` - ┌─ tests/checking/typing/derefrence_invalid.move:6:10 + ┌─ tests/checking/typing/derefrence_invalid.move:6:11 │ 6 │ (*x : bool); - │ ^^ + │ ^ error: expected `&u64` but found `u64` - ┌─ tests/checking/typing/derefrence_invalid.move:7:10 + ┌─ tests/checking/typing/derefrence_invalid.move:7:11 │ 7 │ (*x_mut: &u64); - │ ^^^^^^ + │ ^^^^^ error: expected `M::X` but found `M::S` - ┌─ tests/checking/typing/derefrence_invalid.move:9:10 + ┌─ tests/checking/typing/derefrence_invalid.move:9:11 │ 9 │ (*s: X); - │ ^^ + │ ^ error: expected `bool` but found `u64` ┌─ tests/checking/typing/derefrence_invalid.move:10:12 @@ -43,10 +43,10 @@ error: cannot borrow from a reference │ ^^^^ error: expected `M::X` but found `M::S` - ┌─ tests/checking/typing/derefrence_invalid.move:14:10 + ┌─ tests/checking/typing/derefrence_invalid.move:14:11 │ 14 │ (*s_mut: X); - │ ^^^^^^ + │ ^^^^^ error: expected `bool` but found `u64` ┌─ tests/checking/typing/derefrence_invalid.move:15:12 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp index c54f6508f30c3..cbaf685decb77 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/eq_invalid.exp @@ -1,16 +1,16 @@ Diagnostics: error: invalid call of `==`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/eq_invalid.move:13:9 + ┌─ tests/checking/typing/eq_invalid.move:13:21 │ 13 │ (0: u8) == (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ -error: invalid call of `==`: expected `bool` but found `integer` for argument 2 - ┌─ tests/checking/typing/eq_invalid.move:14:9 +error: invalid call of `==`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/eq_invalid.move:14:14 │ 14 │ 0 == false; - │ ^ + │ ^^^^^ error: unable to infer type: `M::G2` ┌─ tests/checking/typing/eq_invalid.move:28:9 @@ -19,13 +19,13 @@ error: unable to infer type: `M::G2` │ ^^^^ error: invalid call of `==`: tuples have different arity (3 != 2) for argument 2 - ┌─ tests/checking/typing/eq_invalid.move:35:9 + ┌─ tests/checking/typing/eq_invalid.move:35:22 │ 35 │ (1, 2, 3) == (0, 1); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `==`: tuples have different arity (2 != 3) for argument 2 - ┌─ tests/checking/typing/eq_invalid.move:36:9 + ┌─ tests/checking/typing/eq_invalid.move:36:19 │ 36 │ (0, 1) == (1, 2, 3); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/if_mismatched_branches.exp b/third_party/move/move-compiler-v2/tests/checking/typing/if_mismatched_branches.exp index 085825ed4ffe8..5551306ea65c7 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/if_mismatched_branches.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/if_mismatched_branches.exp @@ -1,46 +1,46 @@ Diagnostics: error: expected `()` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:3:27 + ┌─ tests/checking/typing/if_mismatched_branches.move:3:9 │ 3 │ if (cond) () else 0; - │ ^ + │ ^^^^^^^^^^^^^^^^^^^ error: expected `()` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:4:19 + ┌─ tests/checking/typing/if_mismatched_branches.move:4:9 │ 4 │ if (cond) 0 else (); - │ ^ + │ ^^^^^^^^^^^^^^^^^^^ error: expected `address` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:8:29 + ┌─ tests/checking/typing/if_mismatched_branches.move:8:9 │ 8 │ if (cond) @0x0 else 0; - │ ^ + │ ^^^^^^^^^^^^^^^^^^^^^ error: expected `bool` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:9:19 + ┌─ tests/checking/typing/if_mismatched_branches.move:9:9 │ 9 │ if (cond) 0 else false; - │ ^ + │ ^^^^^^^^^^^^^^^^^^^^^^ error: expected `bool` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:13:39 + ┌─ tests/checking/typing/if_mismatched_branches.move:13:9 │ 13 │ if (cond) (0, false) else (1, 1); - │ ^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected `bool` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:14:20 + ┌─ tests/checking/typing/if_mismatched_branches.move:14:9 │ 14 │ if (cond) (0, false) else (false, false); - │ ^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: expected `bool` but found `integer` (in if-else) - ┌─ tests/checking/typing/if_mismatched_branches.move:15:20 + ┌─ tests/checking/typing/if_mismatched_branches.move:15:9 │ 15 │ if (cond) (0, false) else (true, @0x0); - │ ^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: tuples have different arity (3 != 2) (in if-else) ┌─ tests/checking/typing/if_mismatched_branches.move:19:9 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp b/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp index 9b0be842a07cd..ff126e1cfa224 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/lambda.exp @@ -7,16 +7,16 @@ error: `M::reduce` is a function and not a macro │ ^^^^^^ error: invalid call of `+`: expected `integer` but found `&integer` for argument 2 - ┌─ tests/checking/typing/lambda.move:67:31 + ┌─ tests/checking/typing/lambda.move:67:37 │ 67 │ foreach(&v, |e| sum = sum + e) // expected to cannot infer type - │ ^^^^^^^ + │ ^ -error: expected `integer` but found `()` - ┌─ tests/checking/typing/lambda.move:73:43 +error: expected `()` but found `integer` + ┌─ tests/checking/typing/lambda.move:73:44 │ 73 │ foreach(&v, |e| { sum = sum + *e; *e }) // expected to have wrong result type of lambda - │ ^^ + │ ^ error: expected `(&T, u64)` but found `&T` ┌─ tests/checking/typing/lambda.move:40:13 @@ -37,7 +37,7 @@ error: expected `|integer|()` but found `u64` │ ^^^^ error: invalid call of `+`: expected `u64` but found `()` for argument 2 - ┌─ tests/checking/typing/lambda.move:56:17 + ┌─ tests/checking/typing/lambda.move:56:21 │ 56 │ i = i + action(XVector::borrow(v, i)); // expected to have wrong result type - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/loop_body_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/loop_body_invalid.exp index b541a084eb0e4..69ae1bb5e7c74 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/loop_body_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/loop_body_invalid.exp @@ -19,10 +19,10 @@ error: expected `()` but found `address` │ ^^^^ error: expected `()` but found `integer` - ┌─ tests/checking/typing/loop_body_invalid.move:15:24 + ┌─ tests/checking/typing/loop_body_invalid.move:15:27 │ 15 │ loop { let x = 0; x } - │ ^ + │ ^ error: expected `()` but found `integer` ┌─ tests/checking/typing/loop_body_invalid.move:19:26 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type_invalid.exp index 76b40b9363486..bbae0a27e23d1 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/loop_result_type_invalid.exp @@ -13,10 +13,10 @@ error: expected `u64` but found `()` │ ^^^^^^^^^^^^^^^^^^^^^^^^^ error: invalid call of `M::foo`: expected `u64` but found `()` for argument 1 - ┌─ tests/checking/typing/loop_result_type_invalid.move:19:9 + ┌─ tests/checking/typing/loop_result_type_invalid.move:19:13 │ 19 │ foo(loop { break }) - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^^^^^^ error: expected 0 item(s), found 2 ┌─ tests/checking/typing/loop_result_type_invalid.move:26:13 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments_invalid.exp index 21d80dbf7d0ab..aad1b0281dd24 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_explicit_type_arguments_invalid.exp @@ -1,10 +1,10 @@ Diagnostics: error: invalid call of `M::foo`: expected `u64` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:6:9 + ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:6:23 │ 6 │ foo(false, false); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `M::foo`: expected `bool` but found `integer` for argument 1 ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:7:25 @@ -25,13 +25,13 @@ error: invalid call of `M::foo`: expected `bool` but found `integer` for argumen │ ^ error: invalid call of `M::foo`: expected `U` but found `T` for argument 1 - ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:13:9 + ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:13:21 │ 13 │ foo(t, 0); - │ ^^^^^^^^^^^^^^^^^ + │ ^ error: invalid call of `M::foo`: expected `V` but found `U` for argument 1 - ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:14:9 + ┌─ tests/checking/typing/module_call_explicit_type_arguments_invalid.move:14:19 │ 14 │ foo(u, v); - │ ^^^^^^^^^^^^^^^ + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_argument_in_list.exp b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_argument_in_list.exp index ce39d7ce14c7c..f9f1106d9cc8f 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_argument_in_list.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_argument_in_list.exp @@ -1,73 +1,73 @@ Diagnostics: error: invalid call of `M::foo`: expected `address` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:20:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:20:13 │ 20 │ foo(false, 0, S{}); - │ ^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `M::foo`: expected `u64` but found `bool` for argument 2 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:21:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:21:19 │ 21 │ foo(@0x0, false, S{}); - │ ^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `M::foo`: expected `M::S` but found `bool` for argument 3 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:22:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:22:22 │ 22 │ foo(@0x0, 0, false); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `M::foo`: expected `u64` but found `bool` for argument 2 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:23:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:23:19 │ 23 │ foo(@0x0, false, false); - │ ^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `M::foo`: expected `address` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:24:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:24:13 │ 24 │ foo(false, 0, false); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `M::foo`: expected `address` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:25:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:25:13 │ 25 │ foo(false, false, S{}); - │ ^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `X::foo`: expected `address` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:29:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:29:16 │ 29 │ X::foo(false, 0, X::s()); - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `X::foo`: expected `u64` but found `bool` for argument 2 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:30:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:30:22 │ 30 │ X::foo(@0x0, false, X::s()); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `X::foo`: expected `X::S` but found `M::S` for argument 3 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:31:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:31:25 │ 31 │ X::foo(@0x0, 0, S{}); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^^^ error: invalid call of `X::foo`: expected `u64` but found `bool` for argument 2 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:32:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:32:22 │ 32 │ X::foo(@0x0, false, S{}); - │ ^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `X::foo`: expected `address` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:33:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:33:16 │ 33 │ X::foo(false, 0, S{}); - │ ^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ error: invalid call of `X::foo`: expected `address` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:34:9 + ┌─ tests/checking/typing/module_call_wrong_argument_in_list.move:34:16 │ 34 │ X::foo(false, false, X::s()); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_single_argument.exp b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_single_argument.exp index 47659f3f72974..2f29d8d14117a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_single_argument.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/module_call_wrong_single_argument.exp @@ -7,22 +7,22 @@ error: invalid call of `M::foo`: expected `M::S` but found `integer` for argumen │ ^ error: invalid call of `M::bar`: expected `u64` but found `M::S` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_single_argument.move:25:9 + ┌─ tests/checking/typing/module_call_wrong_single_argument.move:25:13 │ 25 │ bar(S{}); - │ ^^^^^^^^ + │ ^^^ error: invalid call of `M::bar`: expected `u64` but found `address` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_single_argument.move:26:9 + ┌─ tests/checking/typing/module_call_wrong_single_argument.move:26:13 │ 26 │ bar(@0x0); - │ ^^^^^^^^^ + │ ^^^^ error: invalid call of `X::foo`: expected `X::S` but found `M::S` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_single_argument.move:30:9 + ┌─ tests/checking/typing/module_call_wrong_single_argument.move:30:16 │ 30 │ X::foo(S{}); - │ ^^^^^^^^^^^ + │ ^^^ error: invalid call of `X::foo`: expected `X::S` but found `integer` for argument 1 ┌─ tests/checking/typing/module_call_wrong_single_argument.move:31:16 @@ -31,13 +31,13 @@ error: invalid call of `X::foo`: expected `X::S` but found `integer` for argumen │ ^ error: invalid call of `X::bar`: expected `u64` but found `M::S` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_single_argument.move:32:9 + ┌─ tests/checking/typing/module_call_wrong_single_argument.move:32:16 │ 32 │ X::bar(S{}); - │ ^^^^^^^^^^^ + │ ^^^ error: invalid call of `X::bar`: expected `u64` but found `bool` for argument 1 - ┌─ tests/checking/typing/module_call_wrong_single_argument.move:33:9 + ┌─ tests/checking/typing/module_call_wrong_single_argument.move:33:16 │ 33 │ X::bar(false); - │ ^^^^^^^^^^^^^ + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/mutate_non_ref.exp b/third_party/move/move-compiler-v2/tests/checking/typing/mutate_non_ref.exp index 67a07cb6e4562..cbbb803dfd691 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/mutate_non_ref.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/mutate_non_ref.exp @@ -1,10 +1,10 @@ Diagnostics: error: expected `&mut integer` but found `integer` - ┌─ tests/checking/typing/mutate_non_ref.move:6:17 + ┌─ tests/checking/typing/mutate_non_ref.move:7:10 │ -6 │ let u = 0; - │ ^ +7 │ *u = 1; + │ ^ error: expected `&mut M::S` but found `M::S` ┌─ tests/checking/typing/mutate_non_ref.move:10:10 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp index 0d11c5efdf7e6..ab8054a720c79 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/neq_invalid.exp @@ -1,16 +1,16 @@ Diagnostics: error: invalid call of `!=`: expected `u8` but found `u128` for argument 2 - ┌─ tests/checking/typing/neq_invalid.move:13:9 + ┌─ tests/checking/typing/neq_invalid.move:13:21 │ 13 │ (0: u8) != (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^ -error: invalid call of `!=`: expected `bool` but found `integer` for argument 2 - ┌─ tests/checking/typing/neq_invalid.move:14:9 +error: invalid call of `!=`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/neq_invalid.move:14:14 │ 14 │ 0 != false; - │ ^ + │ ^^^^^ error: unable to infer type: `M::G0` ┌─ tests/checking/typing/neq_invalid.move:26:9 @@ -19,13 +19,13 @@ error: unable to infer type: `M::G0` │ ^^^^ error: invalid call of `!=`: tuples have different arity (3 != 2) for argument 2 - ┌─ tests/checking/typing/neq_invalid.move:34:9 + ┌─ tests/checking/typing/neq_invalid.move:34:22 │ 34 │ (1, 2, 3) != (0, 1); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: invalid call of `!=`: tuples have different arity (2 != 3) for argument 2 - ┌─ tests/checking/typing/neq_invalid.move:35:9 + ┌─ tests/checking/typing/neq_invalid.move:35:19 │ 35 │ (0, 1) != (1, 2, 3); - │ ^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins_invalid.exp index 8830f7a66ed01..7f8116cb57e50 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/other_builtins_invalid.exp @@ -1,16 +1,16 @@ Diagnostics: error: invalid call of `freeze`: mutability mismatch (&mut != &) for argument 1 - ┌─ tests/checking/typing/other_builtins_invalid.move:4:10 + ┌─ tests/checking/typing/other_builtins_invalid.move:4:22 │ 4 │ (freeze(x): &mut u64); - │ ^^^^^^^^^^^^^^ + │ ^ error: invalid call of `freeze`: mutability mismatch (&mut != &) for argument 1 - ┌─ tests/checking/typing/other_builtins_invalid.move:5:10 + ┌─ tests/checking/typing/other_builtins_invalid.move:5:31 │ 5 │ (freeze>(&any()): &mut vector); - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^^^^^^ error: expected `u64` but found `bool` ┌─ tests/checking/typing/other_builtins_invalid.move:7:22 diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/recursive_local.exp b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_local.exp index 3df4d504fa478..4194642b98a4a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/recursive_local.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_local.exp @@ -1,6 +1,6 @@ Diagnostics: -error: type unification cycle check failed (`?3 =?= (?3, integer)`, try to annotate type) +error: type unification cycle check failed (`?3 =?= (?3, integer)`, try to annotate type) (from assignment or declaration context) ┌─ tests/checking/typing/recursive_local.move:5:9 │ 5 │ x = (x, 0); diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/shadowing_invalid_types.exp b/third_party/move/move-compiler-v2/tests/checking/typing/shadowing_invalid_types.exp index c6022439aa81f..9e1526cfd0af9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/shadowing_invalid_types.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/shadowing_invalid_types.exp @@ -1,10 +1,10 @@ Diagnostics: error: expected `bool` but found `integer` - ┌─ tests/checking/typing/shadowing_invalid_types.move:5:17 + ┌─ tests/checking/typing/shadowing_invalid_types.move:8:10 │ -5 │ let x = 0; - │ ^ +8 │ (x: bool); + │ ^ error: expected `u64` but found `bool` ┌─ tests/checking/typing/shadowing_invalid_types.move:10:27 @@ -37,10 +37,10 @@ error: expected `u64` but found `address` │ ^ error: expected `address` but found `integer` - ┌─ tests/checking/typing/shadowing_invalid_types.move:18:17 + ┌─ tests/checking/typing/shadowing_invalid_types.move:27:10 │ -18 │ let x = 0; - │ ^ +27 │ (x: address); + │ ^ error: expected `u64` but found `bool` ┌─ tests/checking/typing/shadowing_invalid_types.move:34:14 @@ -49,7 +49,7 @@ error: expected `u64` but found `bool` │ ^ error: expected `bool` but found `integer` - ┌─ tests/checking/typing/shadowing_invalid_types.move:31:17 + ┌─ tests/checking/typing/shadowing_invalid_types.move:37:10 │ -31 │ let x = 0; - │ ^ +37 │ (x: bool); + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args_invalid.exp index 8dffa6330da48..81ce961a1df63 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_args_invalid.exp @@ -1,31 +1,31 @@ Diagnostics: error: invalid call of `M::mut`: mutability mismatch (&mut != &) for argument 1 - ┌─ tests/checking/typing/subtype_args_invalid.move:10:9 + ┌─ tests/checking/typing/subtype_args_invalid.move:10:18 │ 10 │ mut(&0); - │ ^^^^^^^^^^^^ + │ ^^ error: invalid call of `M::mut`: expected `u64` but found `M::S` for argument 1 - ┌─ tests/checking/typing/subtype_args_invalid.move:11:9 + ┌─ tests/checking/typing/subtype_args_invalid.move:11:18 │ 11 │ mut(&S{}); - │ ^^^^^^^^^^^^^^ + │ ^^^^ error: invalid call of `M::imm_mut`: mutability mismatch (&mut != &) for argument 2 - ┌─ tests/checking/typing/subtype_args_invalid.move:15:9 + ┌─ tests/checking/typing/subtype_args_invalid.move:15:26 │ 15 │ imm_mut(&0, &0); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^^ error: invalid call of `M::mut_imm`: mutability mismatch (&mut != &) for argument 1 - ┌─ tests/checking/typing/subtype_args_invalid.move:16:9 + ┌─ tests/checking/typing/subtype_args_invalid.move:16:22 │ 16 │ mut_imm(&0, &0); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^^ error: invalid call of `M::mut_mut`: mutability mismatch (&mut != &) for argument 1 - ┌─ tests/checking/typing/subtype_args_invalid.move:17:9 + ┌─ tests/checking/typing/subtype_args_invalid.move:17:22 │ 17 │ mut_mut(&0, &0); - │ ^^^^^^^^^^^^^^^^^^^^ + │ ^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign_invalid.exp index ccf2af5d392cf..79909e49500f6 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/subtype_assign_invalid.exp @@ -6,25 +6,25 @@ error: mutability mismatch (&mut != &) 5 │ let x: &mut u64 = &0; │ ^^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/subtype_assign_invalid.move:10:10 │ 10 │ (x, y) = (&0, &0); │ ^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/subtype_assign_invalid.move:10:13 │ 10 │ (x, y) = (&0, &0); │ ^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/subtype_assign_invalid.move:13:10 │ 13 │ (x, y) = (&0, &0); │ ^ -error: mutability mismatch (&mut != &) +error: mutability mismatch (&mut != &) (from assignment or declaration context) ┌─ tests/checking/typing/subtype_assign_invalid.move:16:13 │ 16 │ (x, y)= (&0, &0); diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack_invalid.exp index f3a5d30840a03..ee9deb614729b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_single_pack_invalid.exp @@ -6,8 +6,8 @@ error: expected `bool` but found `integer` 5 │ let b = Box { f1: false, f2: 1 }; │ ^ -error: expected `bool` but found `integer` - ┌─ tests/checking/typing/type_variable_join_single_pack_invalid.move:6:38 +error: expected `integer` but found `bool` + ┌─ tests/checking/typing/type_variable_join_single_pack_invalid.move:6:55 │ 6 │ let b2 = Box { f1: Box { f1: 0, f2: 0 }, f2: Box { f1: false, f2: false } }; - │ ^ + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack_invalid.exp index b54da67a55612..67beeb855313b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_pack_invalid.exp @@ -1,7 +1,7 @@ Diagnostics: error: expected `bool` but found `integer` - ┌─ tests/checking/typing/type_variable_join_threaded_pack_invalid.move:39:32 + ┌─ tests/checking/typing/type_variable_join_threaded_pack_invalid.move:42:9 │ -39 │ Container::put(&mut v, 0); - │ ^ +42 │ b + │ ^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.exp index e6707ce5020fe..a464c86b9b018 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.exp @@ -1,7 +1,7 @@ Diagnostics: error: expected `bool` but found `integer` - ┌─ tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.move:35:42 + ┌─ tests/checking/typing/type_variable_join_threaded_unpack_assign_invalid.move:36:9 │ -35 │ Container::put(&mut v, Box { f1: 0, f2: 0}); - │ ^ +36 │ f1 + │ ^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_invalid.exp index 893b93ba865ad..5b006c1fb0514 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/type_variable_join_threaded_unpack_invalid.exp @@ -1,7 +1,7 @@ Diagnostics: error: expected `bool` but found `integer` - ┌─ tests/checking/typing/type_variable_join_threaded_unpack_invalid.move:33:42 + ┌─ tests/checking/typing/type_variable_join_threaded_unpack_invalid.move:34:9 │ -33 │ Container::put(&mut v, Box { f1: 0, f2: 0}); - │ ^ +34 │ f1 + │ ^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/unary_not_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/unary_not_invalid.exp index 3f8e559528d76..bf802bd3d5a33 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/unary_not_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/unary_not_invalid.exp @@ -1,16 +1,16 @@ Diagnostics: error: invalid call of `!`: expected `bool` but found `&bool` for argument 1 - ┌─ tests/checking/typing/unary_not_invalid.move:7:9 + ┌─ tests/checking/typing/unary_not_invalid.move:7:10 │ 7 │ !&true; - │ ^^^^^^ + │ ^^^^^ error: invalid call of `!`: expected `bool` but found `&bool` for argument 1 - ┌─ tests/checking/typing/unary_not_invalid.move:8:9 + ┌─ tests/checking/typing/unary_not_invalid.move:8:10 │ 8 │ !&false; - │ ^^^^^^^ + │ ^^^^^^ error: invalid call of `!`: expected `bool` but found `integer` for argument 1 ┌─ tests/checking/typing/unary_not_invalid.move:9:10 @@ -25,25 +25,25 @@ error: invalid call of `!`: expected `bool` but found `integer` for argument 1 │ ^ error: invalid call of `!`: expected `bool` but found `M::R` for argument 1 - ┌─ tests/checking/typing/unary_not_invalid.move:11:9 + ┌─ tests/checking/typing/unary_not_invalid.move:11:10 │ 11 │ !r; - │ ^^ + │ ^ error: invalid call of `!`: expected `bool` but found `M::R` for argument 1 - ┌─ tests/checking/typing/unary_not_invalid.move:12:9 + ┌─ tests/checking/typing/unary_not_invalid.move:12:10 │ 12 │ !r; - │ ^^ + │ ^ error: invalid call of `!`: expected `bool` but found `(integer, bool)` for argument 1 - ┌─ tests/checking/typing/unary_not_invalid.move:13:9 + ┌─ tests/checking/typing/unary_not_invalid.move:13:10 │ 13 │ !(0, false); - │ ^^^^^^^^^^^ + │ ^^^^^^^^^^ error: invalid call of `!`: expected `bool` but found `()` for argument 1 - ┌─ tests/checking/typing/unary_not_invalid.move:14:9 + ┌─ tests/checking/typing/unary_not_invalid.move:14:10 │ 14 │ !(); - │ ^^^ + │ ^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/vector_mismatched_args.exp b/third_party/move/move-compiler-v2/tests/checking/typing/vector_mismatched_args.exp index 2596cf45469bd..64918979e6773 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/vector_mismatched_args.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/vector_mismatched_args.exp @@ -1,10 +1,10 @@ Diagnostics: error: expected `bool` but found `integer` - ┌─ tests/checking/typing/vector_mismatched_args.move:7:16 + ┌─ tests/checking/typing/vector_mismatched_args.move:7:19 │ 7 │ vector[0, false]; - │ ^ + │ ^^^^^ error: expected `u8` but found `u64` ┌─ tests/checking/typing/vector_mismatched_args.move:8:21 @@ -13,10 +13,10 @@ error: expected `u8` but found `u64` │ ^^^^ error: expected `address` but found `integer` - ┌─ tests/checking/typing/vector_mismatched_args.move:9:16 + ┌─ tests/checking/typing/vector_mismatched_args.move:9:19 │ 9 │ vector[0, @0]; - │ ^ + │ ^^ error: expected `Test::X` but found `Test::Y` ┌─ tests/checking/typing/vector_mismatched_args.move:10:21 @@ -25,7 +25,7 @@ error: expected `Test::X` but found `Test::Y` │ ^^^ error: expected `bool` but found `integer` - ┌─ tests/checking/typing/vector_mismatched_args.move:11:17 + ┌─ tests/checking/typing/vector_mismatched_args.move:11:20 │ 11 │ vector[&0, &false]; - │ ^ + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/while_body_invalid.exp b/third_party/move/move-compiler-v2/tests/checking/typing/while_body_invalid.exp index 6871754b08aa1..09bfd88c6bd5e 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/while_body_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/while_body_invalid.exp @@ -19,10 +19,10 @@ error: expected `()` but found `address` │ ^^^^ error: expected `()` but found `integer` - ┌─ tests/checking/typing/while_body_invalid.move:6:32 + ┌─ tests/checking/typing/while_body_invalid.move:6:35 │ 6 │ while (cond) { let x = 0; x }; - │ ^ + │ ^ error: expected `()` but found `integer` ┌─ tests/checking/typing/while_body_invalid.move:7:34 diff --git a/third_party/move/move-model/src/builder/exp_builder.rs b/third_party/move/move-model/src/builder/exp_builder.rs index 61334480f2e66..a27cd717b66c1 100644 --- a/third_party/move/move-model/src/builder/exp_builder.rs +++ b/third_party/move/move-model/src/builder/exp_builder.rs @@ -1197,7 +1197,7 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo &loc, &Type::Tuple(vars.clone()), &expected_type, - "", + "from assignment or declaration context", ); vars }; @@ -1266,7 +1266,7 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo loc, &local_ty, expected_type, - "", + "from assignment or declaration context", ); } else { self.error( @@ -2277,9 +2277,19 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo &arg_ty, &instantiated, ) { + let arg_loc = if i < translated_args.len() { + Some( + self.parent + .parent + .env + .get_node_loc(translated_args[i].node_id()), + ) + } else { + None + }; outruled.push(( cand, - err.specific_loc(), + arg_loc, format!( "{} for argument {}", err.message(&self.type_display_context()), diff --git a/third_party/move/move-model/src/ty.rs b/third_party/move/move-model/src/ty.rs index b8d9eca44c963..06c0c883bbd7e 100644 --- a/third_party/move/move-model/src/ty.rs +++ b/third_party/move/move-model/src/ty.rs @@ -823,6 +823,16 @@ impl WideningOrder { WideningOrder::Join => WideningOrder::Join, } } + + /// Combine two orders. If they are the same or Join, self is returned, otherwise swapped + /// order. + pub fn combine(self, other: Self) -> Self { + if self == other || self == WideningOrder::Join { + self + } else { + self.swap() + } + } } impl Substitution { @@ -887,12 +897,20 @@ impl Substitution { /// Binds the type variable. If there are constraints associated with the /// variable, those are evaluated, possibly leading into unification /// errors. - pub fn bind(&mut self, var: u32, ty: Type) -> Result<(), TypeUnificationError> { + pub fn bind( + &mut self, + var: u32, + order: WideningOrder, + ty: Type, + ) -> Result<(), TypeUnificationError> { // Specialize the type before binding, to maximize groundness of type terms. let ty = self.specialize(&ty); if let Some(constrs) = self.constraints.remove(&var) { - for (loc, order, c) in constrs { - self.eval_constraint(&loc, &ty, order, c)? + for (loc, o, c) in constrs { + // The effective order is the one combining the constraint order with the + // context order. The result needs to be swapped because the constraint + // of the variable is evaluated against the given type. + self.eval_constraint(&loc, &ty, o.combine(order).swap(), c)? } } self.subs.insert(var, ty); @@ -920,12 +938,15 @@ impl Substitution { match &c { Constraint::SomeNumber(options) => match ty { Type::Primitive(prim) if options.contains(prim) => Ok(()), - _ => Err(TypeUnificationError::ConstraintUnsatisfied( - loc.clone(), - ty.clone(), - order, - c, - )), + _ => { + println!("mismatch {:?} {:?} {:?}", ty, order, c); + Err(TypeUnificationError::ConstraintUnsatisfied( + loc.clone(), + ty.clone(), + order, + c, + )) + }, }, Constraint::SomeReference(inner_type) => match ty { Type::Reference(_, target_type) => { @@ -1208,7 +1229,7 @@ impl Substitution { } // Cycle check. if !self.occurs_check(&t2, *v1) { - self.bind(*v1, t2.clone())?; + self.bind(*v1, order, t2.clone())?; Ok(Some(t2)) } else { Err(TypeUnificationError::CyclicSubstitution( @@ -1439,11 +1460,8 @@ impl TypeUnificationAdapter { impl TypeUnificationError { /// If this error is associated with a specific location, return this. pub fn specific_loc(&self) -> Option { - match self { - TypeUnificationError::ConstraintUnsatisfied(loc, ..) - | TypeUnificationError::RedirectedError(loc, ..) => Some(loc.clone()), - _ => None, - } + // Not used for now + None } /// Return the message for this error. diff --git a/third_party/move/move-model/tests/sources/expressions_err.exp b/third_party/move/move-model/tests/sources/expressions_err.exp index 09d4b08dc64fc..2f355d80bcd99 100644 --- a/third_party/move/move-model/tests/sources/expressions_err.exp +++ b/third_party/move/move-model/tests/sources/expressions_err.exp @@ -20,7 +20,7 @@ error: invalid call of `>`: expected `num` but found `vector` for argument ┌─ tests/sources/expressions_err.move:27:7 │ 27 │ x > y - │ ^^^^^ + │ ^ error: expected `(num, bool)` but found `bool` ┌─ tests/sources/expressions_err.move:32:7 @@ -29,10 +29,10 @@ error: expected `(num, bool)` but found `bool` │ ^^^^^ error: invalid call of `M::wrongly_typed_callee`: expected `bool` but found `u256` for argument 2 - ┌─ tests/sources/expressions_err.move:37:39 + ┌─ tests/sources/expressions_err.move:37:63 │ 37 │ fun wrongly_typed_caller(): num { wrongly_typed_callee(1, 1) } - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + │ ^ error: expected `num` but found `bool` ┌─ tests/sources/expressions_err.move:41:80 diff --git a/third_party/move/move-model/tests/sources/use_erroneous_schema.exp b/third_party/move/move-model/tests/sources/use_erroneous_schema.exp index d21df91201105..d474de62ce6e0 100644 --- a/third_party/move/move-model/tests/sources/use_erroneous_schema.exp +++ b/third_party/move/move-model/tests/sources/use_erroneous_schema.exp @@ -5,7 +5,7 @@ error: undeclared `M::x` │ ^ error: invalid call of `<`: expected `num` but found `bool` for argument 2 - ┌─ tests/sources/use_erroneous_schema.move:13:17 + ┌─ tests/sources/use_erroneous_schema.move:13:21 │ 13 │ ensures 2 < true; - │ ^^^^^^^^ + │ ^^^^