diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp index bf0ac35debfcf..abac32e9ccaea 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/assign.exp @@ -17,7 +17,7 @@ module 0x42::assign { } private fun assign_pattern(s: assign::S,f: u64,h: u64) { assign::S{ f: f: u64, g: assign::T{ h: h: u64 } } = s; - Add(f, h) + Add(f, h) } private fun assign_struct(s: &mut assign::S) { s = pack assign::S(42, pack assign::T(42)); diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_invalid.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_invalid.exp index 7acb98a08d89d..5d94d822acf86 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/borrow_invalid.exp @@ -5,7 +5,7 @@ module 0x42::borrow { } private fun mut_expr(x: u64) { { - let r: &mut u64 = Borrow(Mutable)(Add(x, 1)); + let r: &mut u64 = Borrow(Mutable)(Add(x, 1)); r = 22; Deref(r) } diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp index 01223e58ad5f1..d0285b41d223f 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/if_else.exp @@ -2,20 +2,20 @@ module 0x42::if_else { private fun if_else(cond: bool,x: u64) { if cond { - Add(x, 1) + Add(x, 1) } else { - Sub(x, 1) + Sub(x, 1) } } private fun if_else_nested(cond: bool,x: u64) { - if Gt(if cond { - Add(x, 1) + if Gt(if cond { + Add(x, 1) } else { - Sub(x, 1) + Sub(x, 1) }, 10) { - Mul(x, 2) + Mul(x, 2) } else { - Div(x, 2) + Div(x, 2) } } } // end 0x42::if_else diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp index 9c7eaf20eb501..506bf4fbb17d5 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop.exp @@ -2,17 +2,17 @@ module 0x42::loops { private fun nested_loop(x: u64) { loop { - if Gt(x, 0) { + if Gt(x, 0) { loop { - if Gt(x, 10) { - x: u64 = Sub(x, 1); + if Gt(x, 10) { + x: u64 = Sub(x, 1); break; Tuple() } else { break } }; - x: u64 = Sub(x, 1); + x: u64 = Sub(x, 1); continue; Tuple() } else { @@ -23,8 +23,8 @@ module 0x42::loops { } private fun while_loop(x: u64) { loop { - if Gt(x, 0) { - x: u64 = Sub(x, 1); + if Gt(x, 0) { + x: u64 = Sub(x, 1); Tuple() } else { break @@ -34,7 +34,7 @@ module 0x42::loops { } private fun while_loop_with_break_and_continue(x: u64) { loop { - if Gt(x, 0) { + if Gt(x, 0) { if Eq(x, 42) { break } else { @@ -45,7 +45,7 @@ module 0x42::loops { } else { Tuple() }; - x: u64 = Sub(x, 1); + x: u64 = Sub(x, 1); Tuple() } else { break diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp index 91b4fc9d00664..de90162dfa8fe 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/loop_invalid.exp @@ -2,7 +2,7 @@ module 0x42::loop_invalid { private fun misplaced_break(x: u64) { loop { - if Gt(x, 0) { + if Gt(x, 0) { break } else { break @@ -14,7 +14,7 @@ module 0x42::loop_invalid { private fun misplaced_continue(x: u64) { continue; loop { - if Gt(x, 0) { + if Gt(x, 0) { continue } else { break diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp index 1fec9e325c643..b7347ebaefc86 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/operators.exp @@ -1,10 +1,10 @@ // ---- Model Dump module 0x42::operators { private fun arithm(x: u64,y: u64) { - Add(x, Mod(Mul(Div(y, Sub(x, y)), y), x)) + Add(x, Mod(Mul(Div(y, Sub(x, y)), y), x)) } private fun bits(x: u64,y: u8) { - BitAnd(Shl(x, y), x) + BitAnd(Shl(x, y), x) } private fun bools(x: bool,y: bool) { Or(Or(Or(And(x, y), And(x, Not(y))), And(Not(x), y)), And(Not(x), Not(y))) @@ -16,7 +16,7 @@ module 0x42::operators { Neq(x, y) } private fun order(x: u64,y: u64) { - And(And(And(Lt(x, y), Le(x, y)), Not(Gt(x, y))), Not(Ge(x, y))) + And(And(And(Lt(x, y), Le(x, y)), Not(Gt(x, y))), Not(Ge(x, y))) } } // end 0x42::operators diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple.exp index 872c351156f1f..f941f64f72308 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple.exp @@ -4,12 +4,12 @@ module 0x42::tuple { f: u64, } private fun tuple(x: u64) { - Tuple(x, pack tuple::S(Add(x, 1))) + Tuple(x, pack tuple::S(Add(x, 1))) } private fun use_tuple(x: u64) { { let (x: u64, tuple::S{ f: y: u64 }) = tuple::tuple(x); - Add(x, y) + Add(x, y) } } } // end 0x42::tuple diff --git a/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple_invalid.exp b/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple_invalid.exp index 9577d83974d76..c215722c9382f 100644 --- a/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/bytecode-generator/tuple_invalid.exp @@ -4,7 +4,7 @@ module 0x42::tuple_invalid { f: u64, } private fun tuple(x: u64) { - Tuple(x, pack tuple_invalid::S(Add(x, 1))) + Tuple(x, pack tuple_invalid::S(Add(x, 1))) } private fun use_tuple1(x: u64) { { 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/specs/assert_skipped_for_spec.exp b/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp index 3972e3333a093..30dd36be497d2 100644 --- a/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp +++ b/third_party/move/move-compiler-v2/tests/checking/specs/assert_skipped_for_spec.exp @@ -1,11 +1,11 @@ // ---- Model Dump module 0x42::M { private fun bar(x: u64) { - if Gt(x, 0) { + if Gt(x, 0) { Tuple() } else { Abort(1) }; - Sub(x, 1) + Sub(x, 1) } } // end 0x42::M 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.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp index 0f6c4364cc336..9329ec49c1275 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_add.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Add(0, 0); - Add(1, 0); - Add(0, 1); - Add(0, 1); - Add(0, 1); - Add(0, 1); - Add(0, 1); - Add(0, 1); - Add(x, x); - Add(select M::R.f(r), select M::R.f(r)); - Add(Add(Add(1, select M::R.f(r)), select M::R.f(r)), 0); + Add(0, 0); + Add(1, 0); + Add(0, 1); + Add(0, 1); + Add(0, 1); + Add(0, 1); + Add(0, 1); + Add(0, 1); + Add(x, x); + Add(select M::R.f(r), select M::R.f(r)); + Add(Add(Add(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 14ced76041ea0..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `+` +error: invalid call of `+`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:8:9 │ 8 │ false + true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/binary_add_invalid.move:9:9 +error: invalid call of `+`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_add_invalid.move:9:13 │ 9 │ 1 + false; - │ ^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `+` +error: invalid call of `+`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:10:9 │ 10 │ false + 1; - │ ^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `+` +error: invalid call of `+`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:11:9 │ 11 │ @0x0 + @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/binary_add_invalid.move:12:9 +error: invalid call of `+`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_add_invalid.move:12:20 │ 12 │ (0: u8) + (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `+` +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; - │ ^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `+` +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; - │ ^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/binary_add_invalid.move:15:9 +error: invalid call of `+`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_add_invalid.move:15:13 │ 15 │ 1 + false + @0x0 + 0; - │ ^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/binary_add_invalid.move:15:9 +error: invalid call of `+`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_add_invalid.move:15:21 │ 15 │ 1 + false + @0x0 + 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `+` +error: invalid call of `+`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_add_invalid.move:16:9 │ 16 │ () + (); - │ ^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/binary_add_invalid.move:17:9 +error: invalid call of `+`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_add_invalid.move:17:13 │ 17 │ 1 + (); - │ ^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `+` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `+` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 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.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp index 553a4e507dc3c..c0873910c83cf 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_and.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - BitAnd(0, 0); - BitAnd(1, 0); - BitAnd(0, 1); - BitAnd(0, 1); - BitAnd(0, 1); - BitAnd(0, 1); - BitAnd(0, 1); - BitAnd(0, 1); - BitAnd(x, x); - BitAnd(select M::R.f(r), select M::R.f(r)); - BitAnd(BitAnd(BitAnd(1, select M::R.f(r)), select M::R.f(r)), 0); + BitAnd(0, 0); + BitAnd(1, 0); + BitAnd(0, 1); + BitAnd(0, 1); + BitAnd(0, 1); + BitAnd(0, 1); + BitAnd(0, 1); + BitAnd(0, 1); + BitAnd(x, x); + BitAnd(select M::R.f(r), select M::R.f(r)); + BitAnd(BitAnd(BitAnd(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 a82a16624cc34..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `&` +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; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `&` - ┌─ tests/checking/typing/binary_bit_and_invalid.move:9:9 +error: invalid call of `&`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:9:13 │ 9 │ 1 & false; - │ ^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `&` +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; - │ ^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `&` +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; - │ ^^^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `&` - ┌─ tests/checking/typing/binary_bit_and_invalid.move:12:9 +error: invalid call of `&`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:12:20 │ 12 │ (0: u8) & (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `&` +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; - │ ^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `&` +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; - │ ^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `&` - ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:9 +error: invalid call of `&`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:13 │ 15 │ 1 & false & @0x0 & 0; - │ ^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `&` - ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:9 +error: invalid call of `&`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:15:21 │ 15 │ 1 & false & @0x0 & 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `&` +error: invalid call of `&`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_bit_and_invalid.move:16:9 │ 16 │ () & (); - │ ^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `&` - ┌─ tests/checking/typing/binary_bit_and_invalid.move:17:9 +error: invalid call of `&`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_bit_and_invalid.move:17:13 │ 17 │ 1 & (); - │ ^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `&` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `&` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `&(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `&(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp index 0843eb73f08a7..10054947af7e9 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_bit_or.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - BitOr(0, 0); - BitOr(1, 0); - BitOr(0, 1); - BitOr(0, 1); - BitOr(0, 1); - BitOr(0, 1); - BitOr(0, 1); - BitOr(0, 1); - BitOr(x, x); - BitOr(select M::R.f(r), select M::R.f(r)); - BitOr(BitOr(BitOr(1, select M::R.f(r)), select M::R.f(r)), 0); + BitOr(0, 0); + BitOr(1, 0); + BitOr(0, 1); + BitOr(0, 1); + BitOr(0, 1); + BitOr(0, 1); + BitOr(0, 1); + BitOr(0, 1); + BitOr(x, x); + BitOr(select M::R.f(r), select M::R.f(r)); + BitOr(BitOr(BitOr(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 bb5a4f646e8f2..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `|` +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; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `|` - ┌─ tests/checking/typing/binary_bit_or_invalid.move:9:9 +error: invalid call of `|`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:9:13 │ 9 │ 1 | false; - │ ^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `|` +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; - │ ^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `|` +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; - │ ^^^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `|` - ┌─ tests/checking/typing/binary_bit_or_invalid.move:12:9 +error: invalid call of `|`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:12:20 │ 12 │ (0: u8) | (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `|` +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; - │ ^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `|` +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; - │ ^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `|` - ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:9 +error: invalid call of `|`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:13 │ 15 │ 1 | false | @0x0 | 0; - │ ^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `|` - ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:9 +error: invalid call of `|`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:15:21 │ 15 │ 1 | false | @0x0 | 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `|` +error: invalid call of `|`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_bit_or_invalid.move:16:9 │ 16 │ () | (); - │ ^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `|` - ┌─ tests/checking/typing/binary_bit_or_invalid.move:17:9 +error: invalid call of `|`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_bit_or_invalid.move:17:13 │ 17 │ 1 | (); - │ ^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `|` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `|` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `|(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `|(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 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 6220da78b511a..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `^` +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; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `^` - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:9:9 +error: invalid call of `^`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:9:13 │ 9 │ 1 ^ false; - │ ^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `^` +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; - │ ^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `^` +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; - │ ^^^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `^` - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:12:9 +error: invalid call of `^`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:12:20 │ 12 │ (0: u8) ^ (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `^` +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; - │ ^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `^` +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; - │ ^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `^` - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:9 +error: invalid call of `^`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:13 │ 15 │ 1 ^ false ^ @0x0 ^ 0; - │ ^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `^` - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:9 +error: invalid call of `^`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:15:21 │ 15 │ 1 ^ false ^ @0x0 ^ 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `^` +error: invalid call of `^`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_bit_xor_invalid.move:16:9 │ 16 │ () ^ (); - │ ^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `^` - ┌─ tests/checking/typing/binary_bit_xor_invalid.move:17:9 +error: invalid call of `^`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_bit_xor_invalid.move:17:13 │ 17 │ 1 ^ (); - │ ^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `^` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `^` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `^(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `^(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp index a48740737e606..cbf941635271c 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_div.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Div(0, 0); - Div(1, 0); - Div(0, 1); - Div(0, 1); - Div(0, 1); - Div(0, 1); - Div(0, 1); - Div(0, 1); - Div(x, x); - Div(select M::R.f(r), select M::R.f(r)); - Div(Div(Div(1, select M::R.f(r)), select M::R.f(r)), 0); + Div(0, 0); + Div(1, 0); + Div(0, 1); + Div(0, 1); + Div(0, 1); + Div(0, 1); + Div(0, 1); + Div(0, 1); + Div(x, x); + Div(select M::R.f(r), select M::R.f(r)); + Div(Div(Div(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 91d208e1fd3e4..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `/` +error: invalid call of `/`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:8:9 │ 8 │ false / true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `/` - ┌─ tests/checking/typing/binary_div_invalid.move:9:9 +error: invalid call of `/`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_div_invalid.move:9:13 │ 9 │ 1 / false; - │ ^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `/` +error: invalid call of `/`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:10:9 │ 10 │ false / 1; - │ ^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `/` +error: invalid call of `/`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:11:9 │ 11 │ @0x0 / @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `/` - ┌─ tests/checking/typing/binary_div_invalid.move:12:9 +error: invalid call of `/`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_div_invalid.move:12:20 │ 12 │ (0: u8) / (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `/` +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; - │ ^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `/` +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; - │ ^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `/` - ┌─ tests/checking/typing/binary_div_invalid.move:15:9 +error: invalid call of `/`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_div_invalid.move:15:13 │ 15 │ 1 / false / @0x0 / 0; - │ ^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `/` - ┌─ tests/checking/typing/binary_div_invalid.move:15:9 +error: invalid call of `/`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_div_invalid.move:15:21 │ 15 │ 1 / false / @0x0 / 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `/` +error: invalid call of `/`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_div_invalid.move:16:9 │ 16 │ () / (); - │ ^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `/` - ┌─ tests/checking/typing/binary_div_invalid.move:17:9 +error: invalid call of `/`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_div_invalid.move:17:13 │ 17 │ 1 / (); - │ ^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `/` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `/` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `/(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `/(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp index 69dc2f2b19391..aba06a31dc47b 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_geq.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Ge(0, 0); - Ge(1, 0); - Ge(0, 1); - Ge(0, 1); - Ge(0, 1); - Ge(0, 1); - Ge(0, 1); - Ge(0, 1); - Ge(x, x); - Ge(select M::R.f(r), select M::R.f(r)); - And(Ge(1, select M::R.f(r)), Ge(select M::R.f(r), 0)); + Ge(0, 0); + Ge(1, 0); + Ge(0, 1); + Ge(0, 1); + Ge(0, 1); + Ge(0, 1); + Ge(0, 1); + Ge(0, 1); + Ge(x, x); + Ge(select M::R.f(r), select M::R.f(r)); + And(Ge(1, select M::R.f(r)), Ge(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() 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 cf56d2440d048..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 @@ -1,183 +1,85 @@ Diagnostics: -error: no matching declaration of `>=` +error: invalid call of `>=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:8:9 │ 8 │ false >= true; - │ ^^^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>=` - ┌─ tests/checking/typing/binary_geq_invalid.move:9:9 +error: invalid call of `>=`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_geq_invalid.move:9:14 │ 9 │ 1 >= false; - │ ^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `>=` +error: invalid call of `>=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:10:9 │ 10 │ false >= 1; - │ ^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>=` +error: invalid call of `>=`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:11:9 │ 11 │ @0x0 >= @0x1; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `>=` - ┌─ tests/checking/typing/binary_geq_invalid.move:12:9 +error: invalid call of `>=`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_geq_invalid.move:12:21 │ 12 │ (0: u8) >= (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `u128` for argument 2) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `u8` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `u8` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `u8` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `u8` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `>=` +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; - │ ^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `>=` +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; - │ ^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `>=` +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; - │ ^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^^ -error: no matching declaration of `>=` - ┌─ tests/checking/typing/binary_geq_invalid.move:16:9 +error: invalid call of `>=`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_geq_invalid.move:16:15 │ 16 │ (1 >= false) && (@0x0 >= 0); - │ ^^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `>=` - ┌─ tests/checking/typing/binary_geq_invalid.move:16:25 +error: invalid call of `>=`: expected `integer` but found `address` for argument 1 + ┌─ tests/checking/typing/binary_geq_invalid.move:16:26 │ 16 │ (1 >= false) && (@0x0 >= 0); - │ ^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `>=` +error: invalid call of `>=`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_geq_invalid.move:17:9 │ 17 │ () >= (); - │ ^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `()` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `()` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `()` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `()` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `()` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `>=` - ┌─ tests/checking/typing/binary_geq_invalid.move:18:9 +error: invalid call of `>=`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_geq_invalid.move:18:14 │ 18 │ 1 >= (); - │ ^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `()` for argument 2) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `()` for argument 2) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `()` for argument 2) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `()` for argument 2) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `()` for argument 2) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `>=` +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); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `>=` +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); - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>=(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `>=(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp index 5262590c0c713..727ff6ce89117 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_gt.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Gt(0, 0); - Gt(1, 0); - Gt(0, 1); - Gt(0, 1); - Gt(0, 1); - Gt(0, 1); - Gt(0, 1); - Gt(0, 1); - Gt(x, x); - Gt(select M::R.f(r), select M::R.f(r)); - And(Gt(1, select M::R.f(r)), Gt(select M::R.f(r), 0)); + Gt(0, 0); + Gt(1, 0); + Gt(0, 1); + Gt(0, 1); + Gt(0, 1); + Gt(0, 1); + Gt(0, 1); + Gt(0, 1); + Gt(x, x); + Gt(select M::R.f(r), select M::R.f(r)); + And(Gt(1, select M::R.f(r)), Gt(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() 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 c1325097dcab0..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 @@ -1,183 +1,85 @@ Diagnostics: -error: no matching declaration of `>` +error: invalid call of `>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:8:9 │ 8 │ false > true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>` - ┌─ tests/checking/typing/binary_gt_invalid.move:9:9 +error: invalid call of `>`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_gt_invalid.move:9:13 │ 9 │ 1 > false; - │ ^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `>` +error: invalid call of `>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:10:9 │ 10 │ false > 1; - │ ^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>` +error: invalid call of `>`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:11:9 │ 11 │ @0x0 > @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `>` - ┌─ tests/checking/typing/binary_gt_invalid.move:12:9 +error: invalid call of `>`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_gt_invalid.move:12:20 │ 12 │ (0: u8) > (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `u128` for argument 2) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `u8` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `u8` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `u8` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `u8` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `>` +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; - │ ^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `>` +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; - │ ^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `>` +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; - │ ^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>` - ┌─ tests/checking/typing/binary_gt_invalid.move:16:9 +error: invalid call of `>`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_gt_invalid.move:16:14 │ 16 │ (1 > false) && (@0x0 > 0); - │ ^^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `>` - ┌─ tests/checking/typing/binary_gt_invalid.move:16:24 +error: invalid call of `>`: expected `integer` but found `address` for argument 1 + ┌─ tests/checking/typing/binary_gt_invalid.move:16:25 │ 16 │ (1 > false) && (@0x0 > 0); - │ ^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `>` +error: invalid call of `>`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_gt_invalid.move:17:9 │ 17 │ () > (); - │ ^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `()` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `()` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `()` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `()` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `()` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `>` - ┌─ tests/checking/typing/binary_gt_invalid.move:18:9 +error: invalid call of `>`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_gt_invalid.move:18:13 │ 18 │ 1 > (); - │ ^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `()` for argument 2) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `()` for argument 2) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `()` for argument 2) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `()` for argument 2) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `()` for argument 2) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `>` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `>` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `>(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `>(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp index 8f91642de5bdd..6596387ce8faa 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_leq.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Le(0, 0); - Le(1, 0); - Le(0, 1); - Le(0, 1); - Le(0, 1); - Le(0, 1); - Le(0, 1); - Le(0, 1); - Le(x, x); - Le(select M::R.f(r), select M::R.f(r)); - And(Le(1, select M::R.f(r)), Le(select M::R.f(r), 0)); + Le(0, 0); + Le(1, 0); + Le(0, 1); + Le(0, 1); + Le(0, 1); + Le(0, 1); + Le(0, 1); + Le(0, 1); + Le(x, x); + Le(select M::R.f(r), select M::R.f(r)); + And(Le(1, select M::R.f(r)), Le(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() 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 9be5c15709997..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 @@ -1,183 +1,85 @@ Diagnostics: -error: no matching declaration of `<=` +error: invalid call of `<=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:8:9 │ 8 │ false <= true; - │ ^^^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<=` - ┌─ tests/checking/typing/binary_leq_invalid.move:9:9 +error: invalid call of `<=`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_leq_invalid.move:9:14 │ 9 │ 1 <= false; - │ ^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `<=` +error: invalid call of `<=`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:10:9 │ 10 │ false <= 1; - │ ^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<=` +error: invalid call of `<=`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:11:9 │ 11 │ @0x0 <= @0x1; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `<=` - ┌─ tests/checking/typing/binary_leq_invalid.move:12:9 +error: invalid call of `<=`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_leq_invalid.move:12:21 │ 12 │ (0: u8) <= (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `u128` for argument 2) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `u8` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `u8` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `u8` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `u8` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `<=` +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; - │ ^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `<=` +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; - │ ^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `<=` +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; - │ ^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^^ -error: no matching declaration of `<=` - ┌─ tests/checking/typing/binary_leq_invalid.move:16:9 +error: invalid call of `<=`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_leq_invalid.move:16:15 │ 16 │ (1 <= false) && (@0x0 <= 0); - │ ^^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `<=` - ┌─ tests/checking/typing/binary_leq_invalid.move:16:25 +error: invalid call of `<=`: expected `integer` but found `address` for argument 1 + ┌─ tests/checking/typing/binary_leq_invalid.move:16:26 │ 16 │ (1 <= false) && (@0x0 <= 0); - │ ^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `<=` +error: invalid call of `<=`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_leq_invalid.move:17:9 │ 17 │ () <= (); - │ ^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `()` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `()` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `()` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `()` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `()` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `<=` - ┌─ tests/checking/typing/binary_leq_invalid.move:18:9 +error: invalid call of `<=`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_leq_invalid.move:18:14 │ 18 │ 1 <= (); - │ ^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `()` for argument 2) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `()` for argument 2) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `()` for argument 2) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `()` for argument 2) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `()` for argument 2) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `<=` +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); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `<=` +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); - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<=(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `<=(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp index 7d57a97b73716..e87b489c0b612 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_lt.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Lt(0, 0); - Lt(1, 0); - Lt(0, 1); - Lt(0, 1); - Lt(0, 1); - Lt(0, 1); - Lt(0, 1); - Lt(0, 1); - Lt(x, x); - Lt(select M::R.f(r), select M::R.f(r)); - And(Lt(1, select M::R.f(r)), Lt(select M::R.f(r), 0)); + Lt(0, 0); + Lt(1, 0); + Lt(0, 1); + Lt(0, 1); + Lt(0, 1); + Lt(0, 1); + Lt(0, 1); + Lt(0, 1); + Lt(x, x); + Lt(select M::R.f(r), select M::R.f(r)); + And(Lt(1, select M::R.f(r)), Lt(select M::R.f(r), 0)); { let M::R{ f: _ } = r; Tuple() 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 1901ed00060b1..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 @@ -1,183 +1,85 @@ Diagnostics: -error: no matching declaration of `<` +error: invalid call of `<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:8:9 │ 8 │ false < true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<` - ┌─ tests/checking/typing/binary_lt_invalid.move:9:9 +error: invalid call of `<`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_lt_invalid.move:9:13 │ 9 │ 1 < false; - │ ^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `<` +error: invalid call of `<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:10:9 │ 10 │ false < 1; - │ ^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<` +error: invalid call of `<`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:11:9 │ 11 │ @0x0 < @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `<` - ┌─ tests/checking/typing/binary_lt_invalid.move:12:9 +error: invalid call of `<`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_lt_invalid.move:12:20 │ 12 │ (0: u8) < (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `u128` for argument 2) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `u8` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `u8` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `u8` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `u8` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `<` +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; - │ ^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `<` +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; - │ ^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `<` +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; - │ ^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<` - ┌─ tests/checking/typing/binary_lt_invalid.move:16:9 +error: invalid call of `<`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_lt_invalid.move:16:14 │ 16 │ (1 < false) && (@0x0 < 0); - │ ^^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `bool` for argument 2) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `bool` for argument 2) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `bool` for argument 2) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `bool` for argument 2) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `<` - ┌─ tests/checking/typing/binary_lt_invalid.move:16:24 +error: invalid call of `<`: expected `integer` but found `address` for argument 1 + ┌─ tests/checking/typing/binary_lt_invalid.move:16:25 │ 16 │ (1 < false) && (@0x0 < 0); - │ ^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `address` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `address` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `address` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `address` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `address` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `<` +error: invalid call of `<`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_lt_invalid.move:17:9 │ 17 │ () < (); - │ ^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `()` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `()` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `()` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `()` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `()` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `<` - ┌─ tests/checking/typing/binary_lt_invalid.move:18:9 +error: invalid call of `<`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_lt_invalid.move:18:13 │ 18 │ 1 < (); - │ ^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `()` for argument 2) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `()` for argument 2) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `()` for argument 2) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `()` for argument 2) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `()` for argument 2) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `<` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `<` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `<(u8, u8): bool` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u16, u16): bool` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u32, u32): bool` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u64, u64): bool` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u128, u128): bool` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `<(u256, u256): bool` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp index dd02b8b4fa2b8..53dae9f9c2baa 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mod.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Mod(0, 0); - Mod(1, 0); - Mod(0, 1); - Mod(0, 1); - Mod(0, 1); - Mod(0, 1); - Mod(0, 1); - Mod(0, 1); - Mod(x, x); - Mod(select M::R.f(r), select M::R.f(r)); - Mod(Mod(Mod(1, select M::R.f(r)), select M::R.f(r)), 0); + Mod(0, 0); + Mod(1, 0); + Mod(0, 1); + Mod(0, 1); + Mod(0, 1); + Mod(0, 1); + Mod(0, 1); + Mod(0, 1); + Mod(x, x); + Mod(select M::R.f(r), select M::R.f(r)); + Mod(Mod(Mod(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 3beeec1eabd1e..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `%` +error: invalid call of `%`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:8:9 │ 8 │ false % true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `%` - ┌─ tests/checking/typing/binary_mod_invalid.move:9:9 +error: invalid call of `%`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_mod_invalid.move:9:13 │ 9 │ 1 % false; - │ ^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `%` +error: invalid call of `%`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:10:9 │ 10 │ false % 1; - │ ^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `%` +error: invalid call of `%`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:11:9 │ 11 │ @0x0 % @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `%` - ┌─ tests/checking/typing/binary_mod_invalid.move:12:9 +error: invalid call of `%`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_mod_invalid.move:12:20 │ 12 │ (0: u8) % (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `%` +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; - │ ^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `%` +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; - │ ^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `%` - ┌─ tests/checking/typing/binary_mod_invalid.move:15:9 +error: invalid call of `%`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_mod_invalid.move:15:13 │ 15 │ 1 % false % @0x0 % 0; - │ ^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `%` - ┌─ tests/checking/typing/binary_mod_invalid.move:15:9 +error: invalid call of `%`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_mod_invalid.move:15:21 │ 15 │ 1 % false % @0x0 % 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `%` +error: invalid call of `%`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_mod_invalid.move:16:9 │ 16 │ () % (); - │ ^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `%` - ┌─ tests/checking/typing/binary_mod_invalid.move:17:9 +error: invalid call of `%`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_mod_invalid.move:17:13 │ 17 │ 1 % (); - │ ^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `%` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `%` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `%(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `%(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp index 4fcaf0d8e56aa..16e486dfaa836 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_mul.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Mul(0, 0); - Mul(1, 0); - Mul(0, 1); - Mul(0, 1); - Mul(0, 1); - Mul(0, 1); - Mul(0, 1); - Mul(0, 1); - Mul(x, x); - Mul(select M::R.f(r), select M::R.f(r)); - Mul(Mul(Mul(1, select M::R.f(r)), select M::R.f(r)), 0); + Mul(0, 0); + Mul(1, 0); + Mul(0, 1); + Mul(0, 1); + Mul(0, 1); + Mul(0, 1); + Mul(0, 1); + Mul(0, 1); + Mul(x, x); + Mul(select M::R.f(r), select M::R.f(r)); + Mul(Mul(Mul(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 28958d64d85ce..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `*` +error: invalid call of `*`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:8:9 │ 8 │ false * true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `*` - ┌─ tests/checking/typing/binary_mul_invalid.move:9:9 +error: invalid call of `*`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_mul_invalid.move:9:13 │ 9 │ 1 * false; - │ ^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `*` +error: invalid call of `*`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:10:9 │ 10 │ false * 1; - │ ^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `*` +error: invalid call of `*`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:11:9 │ 11 │ @0x0 * @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `*` - ┌─ tests/checking/typing/binary_mul_invalid.move:12:9 +error: invalid call of `*`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_mul_invalid.move:12:20 │ 12 │ (0: u8) * (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `*` +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; - │ ^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `*` +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; - │ ^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `*` - ┌─ tests/checking/typing/binary_mul_invalid.move:15:9 +error: invalid call of `*`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_mul_invalid.move:15:13 │ 15 │ 1 * false * @0x0 * 0; - │ ^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `*` - ┌─ tests/checking/typing/binary_mul_invalid.move:15:9 +error: invalid call of `*`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_mul_invalid.move:15:21 │ 15 │ 1 * false * @0x0 * 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `*` +error: invalid call of `*`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_mul_invalid.move:16:9 │ 16 │ () * (); - │ ^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `*` - ┌─ tests/checking/typing/binary_mul_invalid.move:17:9 +error: invalid call of `*`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_mul_invalid.move:17:13 │ 17 │ 1 * (); - │ ^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `*` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `*` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `*(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `*(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 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.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp index cba5c27bb6bae..f69f52e9f8958 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shl.exp @@ -5,16 +5,16 @@ module 0x8675309::M { b: u8, } private fun t0(x: u64,b: u8,r: M::R) { - Shl(0, 0); - Shl(1, 0); - Shl(0, 1); - Shl(0, 1); - Add(0, 1); - Shl(0, 1); - Shl(0, 1); - Shl(x, b); - Shl(select M::R.f(r), select M::R.b(r)); - Shl(Shl(Shl(1, select M::R.b(r)), select M::R.b(r)), 0); + Shl(0, 0); + Shl(1, 0); + Shl(0, 1); + Shl(0, 1); + Add(0, 1); + Shl(0, 1); + Shl(0, 1); + Shl(x, b); + Shl(select M::R.f(r), select M::R.b(r)); + Shl(Shl(Shl(1, select M::R.b(r)), select M::R.b(r)), 0); M::R{ f: _, b: _ } = r } } // end 0x8675309::M 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 4936be7e2552c..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `<<` +error: invalid call of `<<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:8:9 │ 8 │ false << true; - │ ^^^^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<<` - ┌─ tests/checking/typing/binary_shl_invalid.move:9:9 +error: invalid call of `<<`: expected `u8` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_shl_invalid.move:9:14 │ 9 │ 1 << false; - │ ^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u16, u8): u16` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u32, u8): u32` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u64, u8): u64` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u128, u8): u128` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u256, u8): u256` (expected `u8` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `<<` +error: invalid call of `<<`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:10:9 │ 10 │ false << 1; - │ ^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `<<` +error: invalid call of `<<`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:11:9 │ 11 │ @0x0 << @0x1; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `<<` - ┌─ tests/checking/typing/binary_shl_invalid.move:12:9 +error: invalid call of `<<`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_shl_invalid.move:12:21 │ 12 │ (0: u8) << (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `<<` +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; - │ ^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `<<` +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; - │ ^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `<<` - ┌─ tests/checking/typing/binary_shl_invalid.move:15:9 +error: invalid call of `<<`: expected `u8` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_shl_invalid.move:15:14 │ 15 │ 1 << false << @0x0 << 0; - │ ^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u16, u8): u16` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u32, u8): u32` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u64, u8): u64` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u128, u8): u128` (expected `u8` but found `bool` for argument 2) - = outruled candidate `<<(u256, u8): u256` (expected `u8` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `<<` - ┌─ tests/checking/typing/binary_shl_invalid.move:15:9 +error: invalid call of `<<`: expected `u8` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_shl_invalid.move:15:23 │ 15 │ 1 << false << @0x0 << 0; - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `<<(u16, u8): u16` (expected `u8` but found `address` for argument 2) - = outruled candidate `<<(u32, u8): u32` (expected `u8` but found `address` for argument 2) - = outruled candidate `<<(u64, u8): u64` (expected `u8` but found `address` for argument 2) - = outruled candidate `<<(u128, u8): u128` (expected `u8` but found `address` for argument 2) - = outruled candidate `<<(u256, u8): u256` (expected `u8` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `<<` +error: invalid call of `<<`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_shl_invalid.move:16:9 │ 16 │ () << (); - │ ^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `<<` - ┌─ tests/checking/typing/binary_shl_invalid.move:17:9 +error: invalid call of `<<`: expected `u8` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_shl_invalid.move:17:14 │ 17 │ 1 << (); - │ ^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `<<(u16, u8): u16` (expected `u8` but found `()` for argument 2) - = outruled candidate `<<(u32, u8): u32` (expected `u8` but found `()` for argument 2) - = outruled candidate `<<(u64, u8): u64` (expected `u8` but found `()` for argument 2) - = outruled candidate `<<(u128, u8): u128` (expected `u8` but found `()` for argument 2) - = outruled candidate `<<(u256, u8): u256` (expected `u8` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `<<` +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); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `<<` +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); - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `<<(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u16, u8): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u32, u8): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u64, u8): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u128, u8): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `<<(u256, u8): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp index 440e47c084a18..3593564db72bb 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_shr.exp @@ -5,16 +5,16 @@ module 0x8675309::M { b: u8, } private fun t0(x: u64,b: u8,r: M::R) { - Shr(0, 0); - Shr(1, 0); - Shr(0, 1); - Shr(0, 1); - Add(0, 1); - Shr(0, 1); - Shr(0, 1); - Shr(x, b); - Shr(select M::R.f(r), select M::R.b(r)); - Shr(Shr(Shr(1, select M::R.b(r)), select M::R.b(r)), 0); + Shr(0, 0); + Shr(1, 0); + Shr(0, 1); + Shr(0, 1); + Add(0, 1); + Shr(0, 1); + Shr(0, 1); + Shr(x, b); + Shr(select M::R.f(r), select M::R.b(r)); + Shr(Shr(Shr(1, select M::R.b(r)), select M::R.b(r)), 0); M::R{ f: _, b: _ } = r } } // end 0x8675309::M 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 c9ab598cb050a..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `>>` +error: invalid call of `>>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:8:9 │ 8 │ false >> true; - │ ^^^^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>>` - ┌─ tests/checking/typing/binary_shr_invalid.move:9:9 +error: invalid call of `>>`: expected `u8` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_shr_invalid.move:9:14 │ 9 │ 1 >> false; - │ ^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u16, u8): u16` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u32, u8): u32` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u64, u8): u64` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u128, u8): u128` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u256, u8): u256` (expected `u8` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `>>` +error: invalid call of `>>`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:10:9 │ 10 │ false >> 1; - │ ^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `>>` +error: invalid call of `>>`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:11:9 │ 11 │ @0x0 >> @0x1; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `>>` - ┌─ tests/checking/typing/binary_shr_invalid.move:12:9 +error: invalid call of `>>`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_shr_invalid.move:12:21 │ 12 │ (0: u8) >> (1: u128); - │ ^^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `>>` +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; - │ ^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `>>` +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; - │ ^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `>>` - ┌─ tests/checking/typing/binary_shr_invalid.move:15:9 +error: invalid call of `>>`: expected `u8` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_shr_invalid.move:15:14 │ 15 │ 1 >> false >> @0x0 >> 0; - │ ^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u16, u8): u16` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u32, u8): u32` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u64, u8): u64` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u128, u8): u128` (expected `u8` but found `bool` for argument 2) - = outruled candidate `>>(u256, u8): u256` (expected `u8` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `>>` - ┌─ tests/checking/typing/binary_shr_invalid.move:15:9 +error: invalid call of `>>`: expected `u8` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_shr_invalid.move:15:23 │ 15 │ 1 >> false >> @0x0 >> 0; - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `>>(u16, u8): u16` (expected `u8` but found `address` for argument 2) - = outruled candidate `>>(u32, u8): u32` (expected `u8` but found `address` for argument 2) - = outruled candidate `>>(u64, u8): u64` (expected `u8` but found `address` for argument 2) - = outruled candidate `>>(u128, u8): u128` (expected `u8` but found `address` for argument 2) - = outruled candidate `>>(u256, u8): u256` (expected `u8` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `>>` +error: invalid call of `>>`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_shr_invalid.move:16:9 │ 16 │ () >> (); - │ ^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `>>` - ┌─ tests/checking/typing/binary_shr_invalid.move:17:9 +error: invalid call of `>>`: expected `u8` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_shr_invalid.move:17:14 │ 17 │ 1 >> (); - │ ^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `>>(u16, u8): u16` (expected `u8` but found `()` for argument 2) - = outruled candidate `>>(u32, u8): u32` (expected `u8` but found `()` for argument 2) - = outruled candidate `>>(u64, u8): u64` (expected `u8` but found `()` for argument 2) - = outruled candidate `>>(u128, u8): u128` (expected `u8` but found `()` for argument 2) - = outruled candidate `>>(u256, u8): u256` (expected `u8` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `>>` +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); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `>>` +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); - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `>>(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u16, u8): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u32, u8): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u64, u8): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u128, u8): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `>>(u256, u8): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp index 299116a463776..8994d8576c4ae 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_sub.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Sub(0, 0); - Sub(1, 0); - Sub(0, 1); - Sub(0, 1); - Sub(0, 1); - Sub(0, 1); - Sub(0, 1); - Sub(0, 1); - Sub(x, x); - Sub(select M::R.f(r), select M::R.f(r)); - Sub(Sub(Sub(1, select M::R.f(r)), select M::R.f(r)), 0); + Sub(0, 0); + Sub(1, 0); + Sub(0, 1); + Sub(0, 1); + Sub(0, 1); + Sub(0, 1); + Sub(0, 1); + Sub(0, 1); + Sub(x, x); + Sub(select M::R.f(r), select M::R.f(r)); + Sub(Sub(Sub(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 939b63408706e..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 @@ -1,170 +1,79 @@ Diagnostics: -error: no matching declaration of `-` +error: invalid call of `-`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:8:9 │ 8 │ false - true; - │ ^^^^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `-` - ┌─ tests/checking/typing/binary_sub_invalid.move:9:9 +error: invalid call of `-`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_sub_invalid.move:9:13 │ 9 │ 1 - false; - │ ^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `-` +error: invalid call of `-`: expected `integer` but found `bool` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:10:9 │ 10 │ false - 1; - │ ^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `bool` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `bool` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `bool` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `bool` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `bool` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `bool` for argument 1) + │ ^^^^^ -error: no matching declaration of `-` +error: invalid call of `-`: expected `integer` but found `address` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:11:9 │ 11 │ @0x0 - @0x1; - │ ^^^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `address` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `address` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `address` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `address` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `address` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `address` for argument 1) + │ ^^^^ -error: no matching declaration of `-` - ┌─ tests/checking/typing/binary_sub_invalid.move:12:9 +error: invalid call of `-`: expected `u8` but found `u128` for argument 2 + ┌─ tests/checking/typing/binary_sub_invalid.move:12:20 │ 12 │ (0: u8) - (1: u128); - │ ^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `u128` for argument 2) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `u8` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `u8` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `u8` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `u8` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `u8` for argument 1) + │ ^ -error: no matching declaration of `-` +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; - │ ^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `M::R` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `M::R` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `M::R` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `M::R` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `M::R` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `M::R` for argument 1) + │ ^ -error: no matching declaration of `-` +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; - │ ^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `M::S` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `M::S` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `M::S` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `M::S` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `M::S` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `M::S` for argument 1) + │ ^ -error: no matching declaration of `-` - ┌─ tests/checking/typing/binary_sub_invalid.move:15:9 +error: invalid call of `-`: expected `integer` but found `bool` for argument 2 + ┌─ tests/checking/typing/binary_sub_invalid.move:15:13 │ 15 │ 1 - false - @0x0 - 0; - │ ^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `bool` for argument 2) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `bool` for argument 2) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `bool` for argument 2) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `bool` for argument 2) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `bool` for argument 2) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `bool` for argument 2) + │ ^^^^^ -error: no matching declaration of `-` - ┌─ tests/checking/typing/binary_sub_invalid.move:15:9 +error: invalid call of `-`: expected `integer` but found `address` for argument 2 + ┌─ tests/checking/typing/binary_sub_invalid.move:15:21 │ 15 │ 1 - false - @0x0 - 0; - │ ^^^^^^^^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `address` for argument 2) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `address` for argument 2) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `address` for argument 2) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `address` for argument 2) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `address` for argument 2) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `address` for argument 2) + │ ^^^^ -error: no matching declaration of `-` +error: invalid call of `-`: expected `integer` but found `()` for argument 1 ┌─ tests/checking/typing/binary_sub_invalid.move:16:9 │ 16 │ () - (); - │ ^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `()` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `()` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `()` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `()` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `()` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `()` for argument 1) + │ ^^ -error: no matching declaration of `-` - ┌─ tests/checking/typing/binary_sub_invalid.move:17:9 +error: invalid call of `-`: expected `integer` but found `()` for argument 2 + ┌─ tests/checking/typing/binary_sub_invalid.move:17:13 │ 17 │ 1 - (); - │ ^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `()` for argument 2) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `()` for argument 2) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `()` for argument 2) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `()` for argument 2) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `()` for argument 2) + │ ^^ -error: no matching declaration of `-` +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); - │ ^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ -error: no matching declaration of `-` +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); - │ ^^^^^^^^^^^^^^^ - │ - = outruled candidate `-(u8, u8): u8` (expected `u8` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u16, u16): u16` (expected `u16` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u32, u32): u32` (expected `u32` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u64, u64): u64` (expected `u64` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u128, u128): u128` (expected `u128` but found `(integer, integer)` for argument 1) - = outruled candidate `-(u256, u256): u256` (expected `u256` but found `(integer, integer)` for argument 1) + │ ^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp b/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp index 49af5291f7d07..95b5eb145591a 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/binary_xor.exp @@ -4,17 +4,17 @@ module 0x8675309::M { f: u64, } private fun t0(x: u64,r: M::R) { - Xor(0, 0); - Xor(1, 0); - Xor(0, 1); - Xor(0, 1); - Xor(0, 1); - Xor(0, 1); - Xor(0, 1); - Xor(0, 1); - Xor(x, x); - Xor(select M::R.f(r), select M::R.f(r)); - Xor(Xor(Xor(1, select M::R.f(r)), select M::R.f(r)), 0); + Xor(0, 0); + Xor(1, 0); + Xor(0, 1); + Xor(0, 1); + Xor(0, 1); + Xor(0, 1); + Xor(0, 1); + Xor(0, 1); + Xor(x, x); + Xor(select M::R.f(r), select M::R.f(r)); + Xor(Xor(Xor(1, select M::R.f(r)), select M::R.f(r)), 0); { let M::R{ f: _ } = r; Tuple() 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 844e744784dc7..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 `u64` but found `()` +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 bfde9a3b8961d..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 `u64` but found `()` +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.exp b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp index d13935ca436d3..c7312f2f6c5dc 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/block_with_statements.exp @@ -14,7 +14,7 @@ module 0x8675309::M { }; { let y: u64 = 0; - Borrow(Mutable)(Add(y, 1)) + Borrow(Mutable)(Add(y, 1)) }; M::R{ dummy_field: _ } = { let r: M::R = { 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/break_any_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp index 27f7a890dea89..946858d8dbd28 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/break_any_type.exp @@ -10,7 +10,7 @@ module 0x8675309::M { private fun t0() { loop { if true { - Add(0, break); + Add(0, break); Tuple() } else { break diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp index 70e28ca3cfd37..c7899db97f8e3 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/break_outside_loop.exp @@ -5,7 +5,7 @@ module 0x8675309::M { Tuple() } private fun baz(x: u64) { - if Ge(x, 5) { + if Ge(x, 5) { break } else { Tuple() 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 new file mode 100644 index 0000000000000..24810aff45ca9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.exp @@ -0,0 +1,7 @@ + +Diagnostics: +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_inference.move b/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.move new file mode 100644 index 0000000000000..df789a1d6f1d9 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/constant_inference.move @@ -0,0 +1,22 @@ +module 0x42::m { + fun f1(): u8 { + 1 + 2 + 3 // Should automatically infer that it's all u8 + } + + fun f2(): bool { + // Below constant expression should default to u64 + 1 % 2 == 0 + } + + fun f3(x: u8, y: u32) : u32 { + // Should infer r to be a u32 + let r = 1 << x; + y + r + } + + fun f4(x: u8) : u8 { + let r = x + 1 + 2; + let error = 257 + r; // Should error + 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/continue_any_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp index e0619056b0c0f..17fe6f454d3be 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/continue_any_type.exp @@ -10,7 +10,7 @@ module 0x8675309::M { private fun t0() { loop { if true { - Add(0, continue); + Add(0, continue); Tuple() } else { break 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 5e3ccf5ac5c12..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 @@ -6,24 +6,17 @@ error: `M::reduce` is a function and not a macro 34 │ foreach(&v, |e| sum = sum + reduce!(*e, 0, |t, r| t + r)); │ ^^^^^^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/lambda.move:67:31 +error: invalid call of `+`: expected `integer` but found `&integer` for argument 2 + ┌─ tests/checking/typing/lambda.move:67:37 │ 67 │ foreach(&v, |e| sum = sum + e) // expected to cannot infer type - │ ^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `&integer` for argument 2) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `&integer` for argument 2) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `&integer` for argument 2) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `&integer` for argument 2) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `&integer` for argument 2) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `&integer` for argument 2) + │ ^ -error: expected `()` but found `u64` - ┌─ 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 @@ -43,15 +36,8 @@ error: expected `|integer|()` but found `u64` 61 │ x(1) // expected to be not a function │ ^^^^ -error: no matching declaration of `+` - ┌─ tests/checking/typing/lambda.move:56:17 +error: invalid call of `+`: expected `u64` but found `()` for argument 2 + ┌─ tests/checking/typing/lambda.move:56:21 │ 56 │ i = i + action(XVector::borrow(v, i)); // expected to have wrong result type - │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - │ - = outruled candidate `+(u8, u8): u8` (expected `u8` but found `u64` for argument 1) - = outruled candidate `+(u16, u16): u16` (expected `u16` but found `u64` for argument 1) - = outruled candidate `+(u32, u32): u32` (expected `u32` but found `u64` for argument 1) - = outruled candidate `+(u64, u64): u64` (expected `u64` but found `()` for argument 2) - = outruled candidate `+(u128, u128): u128` (expected `u128` but found `u64` for argument 1) - = outruled candidate `+(u256, u256): u256` (expected `u256` but found `u64` for argument 1) + │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp b/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp index f127994b5ff64..189daf2b67796 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/large_binop.exp @@ -1,7 +1,7 @@ // ---- Model Dump module { private fun main() { - Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(And(And(true, true), Not(false)), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))); + Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(Or(And(And(true, true), Not(false)), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))), And(And(Neq>([104, 101, 108, 108, 111], [98, 121, 101]), And(true, true)), Not(false))), And(Eq(Shl(1, 7), 128), Eq(Shr(128, 7), 1))), And(Eq(Div(255, 2), 127), Eq(Mod(255, 2), 1))), And(Eq(Add(254, 1), 255), Eq(Sub(255, 255), 0))), And(Eq(BitAnd(255, 255), 255), Eq(BitOr(255, 255), 255))), And(Eq(Xor(255, 255), 0), Eq>([66], [66]))); Tuple() } } // end 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/return_any_type.exp b/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp index 8a3eba4213ec1..d68508df78f66 100644 --- a/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp +++ b/third_party/move/move-compiler-v2/tests/checking/typing/return_any_type.exp @@ -8,7 +8,7 @@ module 0x8675309::M { Tuple() } private fun t0() { - Add(0, return Tuple()); + Add(0, return Tuple()); Tuple() } private fun t1() { 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/ast.rs b/third_party/move/move-model/src/ast.rs index 5f2cbf1e2c571..5e6c038cb5a67 100644 --- a/third_party/move/move-model/src/ast.rs +++ b/third_party/move/move-model/src/ast.rs @@ -1209,7 +1209,7 @@ impl Operation { ) } - /// Whether the operation alllows to take reference parameters instead of values. This applies + /// Whether the operation allows to take reference parameters instead of values. This applies /// currently to equality which can be used on `(T, T)`, `(T, &T)`, etc. pub fn allows_ref_param_for_value(&self) -> bool { matches!(self, Operation::Eq | Operation::Neq) diff --git a/third_party/move/move-model/src/builder/builtins.rs b/third_party/move/move-model/src/builder/builtins.rs index 92bb1d8b0e9f5..759dda86c8330 100644 --- a/third_party/move/move-model/src/builder/builtins.rs +++ b/third_party/move/move-model/src/builder/builtins.rs @@ -8,14 +8,15 @@ use crate::{ ast::{Operation, TraceKind, Value}, builder::model_builder::{ConstEntry, EntryVisibility, ModelBuilder, SpecOrBuiltinFunEntry}, model::{Parameter, TypeParameter}, - ty::{PrimitiveType, ReferenceKind, Type}, + ty::{Constraint, PrimitiveType, ReferenceKind, Type}, }; use move_compiler::parser::ast::{self as PA}; use move_core_types::u256::U256; use num::BigInt; +use std::collections::BTreeMap; /// Adds specification builtin functions. -pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { +pub(crate) fn declare_builtins(trans: &mut ModelBuilder) { let loc = trans.env.internal_loc(); let bool_t = &Type::new_prim(PrimitiveType::Bool); let num_t = &Type::new_prim(PrimitiveType::Num); @@ -70,9 +71,15 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { } { + use EntryVisibility::{Impl, Spec, SpecAndImpl}; + use PA::BinOp_::*; + // Binary operators. - let mut declare_bin = |op: PA::BinOp_, + let declare_bin_gen = |trans: &mut ModelBuilder, + op: PA::BinOp_, oper: Operation, + type_params: &[TypeParameter], + type_params_constraints: &BTreeMap, param_type1: &Type, param_type2: &Type, result_type: &Type, @@ -80,7 +87,8 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { trans.define_spec_or_builtin_fun(trans.bin_op_symbol(&op), SpecOrBuiltinFunEntry { loc: loc.clone(), oper, - type_params: vec![], + type_params: type_params.to_vec(), + type_param_constraints: type_params_constraints.to_owned(), params: vec![ mk_param(trans, 1, param_type1.clone()), mk_param(trans, 2, param_type2.clone()), @@ -89,49 +97,140 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { visibility, }); }; + let declare_bin = |trans: &mut ModelBuilder, + op: PA::BinOp_, + oper: Operation, + param_type1: &Type, + param_type2: &Type, + result_type: &Type, + visibility: EntryVisibility| { + declare_bin_gen( + trans, + op, + oper, + &[], + &BTreeMap::default(), + param_type1, + param_type2, + result_type, + visibility, + ) + }; - // Numeric operations are individually defined for each integer type in the impl language. - // The spec language uses the unified arbitrary precision num type instead. - use EntryVisibility::{Impl, Spec, SpecAndImpl}; - use PA::BinOp_::*; let u8_ty = Type::Primitive(PrimitiveType::U8); - for prim_ty in [ - PrimitiveType::U8, - PrimitiveType::U16, - PrimitiveType::U32, - PrimitiveType::U64, - PrimitiveType::U128, - PrimitiveType::U256, - PrimitiveType::Num, - ] { - let visibility = if prim_ty == PrimitiveType::Num { - Spec - } else { - Impl - }; - let ty = Type::new_prim(prim_ty); - declare_bin(Add, Operation::Add, &ty, &ty, &ty, visibility); - declare_bin(Sub, Operation::Sub, &ty, &ty, &ty, visibility); - declare_bin(Mul, Operation::Mul, &ty, &ty, &ty, visibility); - declare_bin(Mod, Operation::Mod, &ty, &ty, &ty, visibility); - declare_bin(Div, Operation::Div, &ty, &ty, &ty, visibility); - declare_bin(BitOr, Operation::BitOr, &ty, &ty, &ty, visibility); - declare_bin(BitAnd, Operation::BitAnd, &ty, &ty, &ty, visibility); - declare_bin(Xor, Operation::Xor, &ty, &ty, &ty, visibility); - declare_bin(Shl, Operation::Shl, &ty, &u8_ty, &ty, visibility); - declare_bin(Shr, Operation::Shr, &ty, &u8_ty, &ty, visibility); - declare_bin(Lt, Operation::Lt, &ty, &ty, bool_t, visibility); - declare_bin(Le, Operation::Le, &ty, &ty, bool_t, visibility); - declare_bin(Gt, Operation::Gt, &ty, &ty, bool_t, visibility); - declare_bin(Ge, Operation::Ge, &ty, &ty, bool_t, visibility); - } - - declare_bin(Range, Operation::Range, num_t, num_t, range_t, Spec); - - declare_bin(Implies, Operation::Implies, bool_t, bool_t, bool_t, Spec); - declare_bin(Iff, Operation::Iff, bool_t, bool_t, bool_t, Spec); - declare_bin(And, Operation::And, bool_t, bool_t, bool_t, SpecAndImpl); - declare_bin(Or, Operation::Or, bool_t, bool_t, bool_t, SpecAndImpl); + let declare_arithm_ops = |trans: &mut ModelBuilder, + type_params: &[TypeParameter], + type_constraints: &BTreeMap, + ty: Type, + visibility: EntryVisibility| { + for (op, oper) in [ + (Add, Operation::Add), + (Sub, Operation::Sub), + (Mul, Operation::Mul), + (Mod, Operation::Mod), + (Div, Operation::Div), + (BitOr, Operation::BitOr), + (BitAnd, Operation::BitAnd), + (Xor, Operation::Xor), + ] { + declare_bin_gen( + trans, + op, + oper, + type_params, + type_constraints, + &ty, + &ty, + &ty, + visibility, + ); + } + for (op, oper) in [(Shl, Operation::Shl), (Shr, Operation::Shr)] { + declare_bin_gen( + trans, + op, + oper, + type_params, + type_constraints, + &ty, + &u8_ty, + &ty, + visibility, + ); + } + for (op, oper) in [ + (Lt, Operation::Lt), + (Le, Operation::Le), + (Ge, Operation::Ge), + (Gt, Operation::Gt), + ] { + declare_bin_gen( + trans, + op, + oper, + type_params, + type_constraints, + &ty, + &ty, + bool_t, + visibility, + ); + } + }; + + // Declare the specification arithm ops, based on Num type. + declare_arithm_ops( + trans, + &[], + &BTreeMap::new(), + Type::new_prim(PrimitiveType::Num), + Spec, // visible only in the spec language + ); + // For the implementation arithm ops, we use a generic function with a constraint, + // conceptually: `fun _+_(x: A, y: A): A where A: u8|u16|..|u256`. + declare_arithm_ops( + trans, + &[param_t_decl.clone()], + &[( + 0, + Constraint::SomeNumber(PrimitiveType::all_int_types().into_iter().collect()), + )] + .into_iter() + .collect(), + param_t.clone(), + Impl, // visible only in the impl language + ); + + declare_bin(trans, Range, Operation::Range, num_t, num_t, range_t, Spec); + + declare_bin( + trans, + Implies, + Operation::Implies, + bool_t, + bool_t, + bool_t, + Spec, + ); + declare_bin(trans, Iff, Operation::Iff, bool_t, bool_t, bool_t, Spec); + declare_bin( + trans, + And, + Operation::And, + bool_t, + bool_t, + bool_t, + SpecAndImpl, + ); + declare_bin( + trans, + Or, + Operation::Or, + bool_t, + bool_t, + bool_t, + SpecAndImpl, + ); // Eq and Neq have special treatment because they are generic. trans.define_spec_or_builtin_fun( @@ -140,6 +239,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Eq, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, param_t.clone()), mk_param(trans, 2, param_t.clone()), @@ -154,6 +254,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Neq, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, param_t.clone()), mk_param(trans, 2, param_t.clone()), @@ -173,6 +274,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Not, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, bool_t.clone())], result_type: bool_t.clone(), visibility: SpecAndImpl, @@ -195,6 +297,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MaxU8, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: num_t.clone(), visibility: Spec, @@ -208,6 +311,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MaxU16, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: num_t.clone(), visibility: Spec, @@ -221,6 +325,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MaxU32, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: num_t.clone(), visibility: Spec, @@ -233,6 +338,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MaxU64, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: num_t.clone(), visibility: Spec, @@ -246,6 +352,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { oper: Operation::MaxU128, type_params: vec![], params: vec![], + type_param_constraints: BTreeMap::default(), result_type: num_t.clone(), visibility: Spec, }, @@ -258,6 +365,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MaxU256, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: num_t.clone(), visibility: Spec, @@ -271,6 +379,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Len, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, vector_t.clone())], result_type: num_t.clone(), visibility: Spec, @@ -282,6 +391,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::UpdateVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, vector_t.clone()), mk_param(trans, 2, num_t.clone()), @@ -297,6 +407,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::EmptyVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: vector_t.clone(), visibility: Spec, @@ -308,6 +419,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::SingleVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, param_t.clone())], result_type: vector_t.clone(), visibility: Spec, @@ -319,6 +431,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::ConcatVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, vector_t.clone()), mk_param(trans, 2, vector_t.clone()), @@ -333,6 +446,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::ContainsVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, vector_t.clone()), mk_param(trans, 2, param_t.clone()), @@ -347,6 +461,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::IndexOfVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, vector_t.clone()), mk_param(trans, 2, param_t.clone()), @@ -361,6 +476,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::InRangeVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, vector_t.clone()), mk_param(trans, 2, num_t.clone()), @@ -375,6 +491,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::InRangeRange, type_params: vec![], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param(trans, 1, range_t.clone()), mk_param(trans, 2, num_t.clone()), @@ -389,6 +506,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::RangeVec, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, vector_t.clone())], result_type: range_t.clone(), visibility: Spec, @@ -402,6 +520,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Global(None), type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, address_t.clone())], result_type: param_t.clone(), visibility: Spec, @@ -415,6 +534,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::BorrowGlobal(ReferenceKind::Immutable), type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, address_t.clone())], result_type: ref_param_t.clone(), visibility: SpecAndImpl, // Visible in specs also for translate_fun_as_spec mode @@ -426,6 +546,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::BorrowGlobal(ReferenceKind::Mutable), type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, address_t.clone())], result_type: mut_ref_param_t.clone(), visibility: SpecAndImpl, // Visible in specs also for translate_fun_as_spec mode @@ -437,6 +558,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Freeze, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, mut_ref_param_t)], result_type: ref_param_t, visibility: Impl, @@ -449,6 +571,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MoveTo, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![ mk_param( trans, @@ -470,6 +593,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::MoveFrom, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, address_t.clone())], result_type: param_t.clone(), visibility: Impl, @@ -482,6 +606,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Exists(None), type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, address_t.clone())], result_type: bool_t.clone(), visibility: SpecAndImpl, @@ -494,6 +619,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::TypeDomain, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![], result_type: domain_t.clone(), visibility: Spec, @@ -507,6 +633,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Old, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, param_t.clone())], result_type: param_t.clone(), visibility: Spec, @@ -520,6 +647,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Trace(TraceKind::User), type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, param_t.clone())], result_type: param_t.clone(), visibility: Spec, @@ -533,6 +661,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc: loc.clone(), oper: Operation::Bv2Int, type_params: vec![param_t_decl.clone()], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, param_t.clone())], result_type: param_t.clone(), visibility: Spec, @@ -546,6 +675,7 @@ pub(crate) fn declare_builtins(trans: &mut ModelBuilder<'_>) { loc, oper: Operation::Int2Bv, type_params: vec![param_t_decl], + type_param_constraints: BTreeMap::default(), params: vec![mk_param(trans, 1, param_t.clone())], result_type: param_t.clone(), visibility: Spec, 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 0262e1a0f068c..a27cd717b66c1 100644 --- a/third_party/move/move-model/src/builder/exp_builder.rs +++ b/third_party/move/move-model/src/builder/exp_builder.rs @@ -16,8 +16,8 @@ use crate::{ }, symbol::{Symbol, SymbolPool}, ty::{ - Constraint, PrimitiveType, ReferenceKind, Substitution, Type, TypeDisplayContext, Variance, - WideningOrder, BOOL_TYPE, + Constraint, PrimitiveType, ReferenceKind, Substitution, Type, TypeDisplayContext, + TypeUnificationError, Variance, WideningOrder, BOOL_TYPE, }, }; use codespan_reporting::diagnostic::Severity; @@ -233,6 +233,15 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo idx } + /// Creates a fresh type variable with an associated constraint. + fn fresh_type_var_constr(&mut self, loc: Loc, order: WideningOrder, ctr: Constraint) -> Type { + let idx = self.fresh_type_var_idx(); + self.subs + .add_constraint(idx, loc, order, ctr) + .expect("success on fresh var"); + Type::Var(idx) + } + /// Creates N fresh type variables. fn fresh_type_vars(&mut self, n: usize) -> Vec { (0..n).map(|_| self.fresh_type_var()).collect() @@ -1088,14 +1097,12 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo }, EA::Exp_::Dereference(exp) => { self.require_impl_language(&loc); - let var = self.fresh_type_var_idx(); - self.subs.add_constraint( - var, + let var = self.fresh_type_var_constr( loc.clone(), WideningOrder::LeftToRight, Constraint::SomeReference(expected_type.clone()), ); - let target_exp = self.translate_exp(exp, &Type::Var(var)); + let target_exp = self.translate_exp(exp, &var); let id = self.new_node_id_with_type_loc(expected_type, &loc); ExpData::Call(id, Operation::Deref, vec![target_exp.into_exp()]) }, @@ -1185,7 +1192,13 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo } else { let vars = self.fresh_type_vars(list.value.len()); // Just bind the variables - self.check_type(&loc, &Type::Tuple(vars.clone()), &expected_type, ""); + self.check_type_with_order( + expected_order, + &loc, + &Type::Tuple(vars.clone()), + &expected_type, + "from assignment or declaration context", + ); vars }; if elem_expected_types.len() != list.value.len() { @@ -1253,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( @@ -1421,14 +1434,11 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo // Multiple possible types, need to be expressed by a constraint. Note the range // check is not needed in this case since the possible types are derived from the // value - let var = self.fresh_type_var_idx(); - self.subs.add_constraint( - var, + self.fresh_type_var_constr( loc.clone(), - WideningOrder::LeftToRight, + WideningOrder::RightToLeft, // since we use the type on the lhs below Constraint::SomeNumber(possible_types.into_iter().collect()), - ); - Type::Var(var) + ) }; let ty = self.check_type(loc, &ty, expected_type, ""); (Value::Number(value), ty) @@ -1763,12 +1773,14 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo let item_type = self.subs.specialize(&item_type); if self.subs.is_free_var_without_constraints(&item_type) { // If this is a totally unbound item, assign default unit type. - self.subs.add_constraint( - var, - exp_loc, - WideningOrder::LeftToRight, - Constraint::WithDefault(Type::unit()), - ); + self.subs + .add_constraint( + var, + exp_loc, + WideningOrder::LeftToRight, + Constraint::WithDefault(Type::unit()), + ) + .expect("success on fresh var"); } if self.mode == ExpTranslationMode::TryImplAsSpec @@ -2222,13 +2234,30 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo continue; } let (instantiation, diag) = - self.make_instantiation(type_params.len(), vec![], generics.clone()); + self.make_instantiation(type_params.len(), generics.clone()); if let Some(msg) = diag { outruled.push((cand, None, msg)); continue; } + // Clone the current substitution, then unify arguments against parameter types. let mut subs = self.subs.clone(); + // If there are any type constraints, impose them on the type parameter instantiation. + if let AnyFunEntry::SpecOrBuiltin(sbf) = cand { + if let Err(err) = self.add_constraints( + &mut subs, + loc, + &instantiation, + &sbf.type_param_constraints, + ) { + outruled.push(( + cand, + err.specific_loc(), + err.message(&self.type_display_context()), + )); + continue; + } + } let mut success = true; for (i, arg_ty) in arg_types.iter().enumerate() { let arg_ty = if cand.get_operation().allows_ref_param_for_value() { @@ -2248,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()), @@ -2262,12 +2301,9 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo } } if success { - matching.push((cand, subs, instantiation)); + matching.push((cand, subs, instantiation)) } } - if matching.len() > 1 { - self.builtin_prioritization(&mut matching) - } // Deliver results, reporting errors if there are no or ambiguous matches. match matching.len() { 0 => { @@ -2305,6 +2341,7 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo 1 => { let (cand, subs, instantiation) = matching.remove(0); let (_, _, result_type) = cand.get_signature(); + let result_type = result_type.instantiate(&instantiation); // Commit the candidate substitution to this expression translator. self.subs = subs; // Now translate lambda-based arguments passing expected type to aid type inference. @@ -2316,12 +2353,7 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo } } // Check result type against expected type. - let ty = self.check_type( - loc, - &result_type.instantiate(&instantiation), - expected_type, - "", - ); + let ty = self.check_type(loc, &result_type, expected_type, ""); // calls to built-in functions might have additional requirements on the types let oper = cand.get_operation(); match oper { @@ -2433,30 +2465,6 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo } } - /// Apply ad-hoc overload resolution rules for functions which are builtin operators. - /// This is necessary to grandfather a checking rule s.t. in `0 + 0`, where in fact the - /// function `+` is ambiguous because `0` can be a constant of any integer type, is - /// automatically biased towards choosing the type to be `u64`. For user level overloads, - /// this is not guaranteed. - fn builtin_prioritization(&self, cands: &mut Vec<(&AnyFunEntry, Substitution, Vec)>) { - // See whether this is an overload of arithmetic function - if cands.iter().all(|(e, _, _)| { - use Operation::*; - matches!( - e.get_operation(), - Add | Sub | Mul | Div | Mod | BitOr | BitAnd | Xor | Shl | Shr | Lt | Le | Gt | Ge - ) - }) { - // Find the u64 overload -- if there, prioritize - if let Some(idx) = cands.iter().position(|(e, _, _)| { - let (_, params, _) = e.get_signature(); - params.len() == 2 && params[0].1 == Type::new_prim(PrimitiveType::U64) - }) { - *cands = vec![cands.remove(idx)] - } - } - } - /// Translate a list of expressions and deliver them together with their types. fn translate_exp_list( &mut self, @@ -2489,10 +2497,9 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo fn make_instantiation( &mut self, param_count: usize, - context_args: Vec, user_args: Option>, ) -> (Vec, Option) { - let mut args = context_args; + let mut args = vec![]; let expected_user_count = param_count - args.len(); if let Some(types) = user_args { let n = types.len(); @@ -2517,6 +2524,22 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo } } + /// Adds the constraints to the provided types, reporting errors if the types cannot satisfy + /// the constraints. + fn add_constraints( + &mut self, + subs: &mut Substitution, + loc: &Loc, + args: &[Type], + constraints: &BTreeMap, + ) -> Result<(), TypeUnificationError> { + for (idx, ctr) in constraints { + let ty = &args[*idx]; + subs.eval_constraint(loc, ty, WideningOrder::LeftToRight, ctr.to_owned())?; + } + Ok(()) + } + fn translate_pack( &mut self, loc: &Loc, @@ -2571,8 +2594,7 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo let generics = generics.as_ref().map(|ts| self.translate_types(ts)); if let Some(entry) = self.parent.parent.struct_table.get(&struct_name) { let entry = entry.clone(); - let (instantiation, diag) = - self.make_instantiation(entry.type_params.len(), vec![], generics); + let (instantiation, diag) = self.make_instantiation(entry.type_params.len(), generics); if let Some(msg) = diag { self.error(loc, &msg); return None; @@ -2799,23 +2821,32 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo match res { Ok(t) => t, Err(err) => { - self.error( - &err.specific_loc().unwrap_or_else(|| loc.clone()), - &format!( - "{}{}", - err.message(&self.type_display_context()), - if context_msg.is_empty() { - "".to_string() - } else { - format!(" ({})", context_msg) - } - ), - ); + self.report_unification_error(loc, err, context_msg); Type::Error }, } } + fn report_unification_error( + &mut self, + loc: &Loc, + err: TypeUnificationError, + context_msg: &str, + ) { + self.error( + &err.specific_loc().unwrap_or_else(|| loc.clone()), + &format!( + "{}{}", + err.message(&self.type_display_context()), + if context_msg.is_empty() { + "".to_string() + } else { + format!(" ({})", context_msg) + } + ), + ) + } + pub fn translate_from_move_value(&mut self, loc: &Loc, ty: &Type, value: &MoveValue) -> Value { match (ty, value) { (_, MoveValue::U8(n)) => Value::Number(BigInt::from_u8(*n).unwrap()), diff --git a/third_party/move/move-model/src/builder/model_builder.rs b/third_party/move/move-model/src/builder/model_builder.rs index 9e9d74babf53a..d4422b704efe2 100644 --- a/third_party/move/move-model/src/builder/model_builder.rs +++ b/third_party/move/move-model/src/builder/model_builder.rs @@ -16,7 +16,7 @@ use crate::{ SpecVarId, StructId, TypeParameter, }, symbol::Symbol, - ty::Type, + ty::{Constraint, Type}, }; use codespan_reporting::diagnostic::Severity; #[allow(unused_imports)] @@ -67,6 +67,7 @@ pub(crate) struct SpecOrBuiltinFunEntry { pub loc: Loc, pub oper: Operation, pub type_params: Vec, + pub type_param_constraints: BTreeMap, pub params: Vec, pub result_type: Type, pub visibility: EntryVisibility, diff --git a/third_party/move/move-model/src/builder/module_builder.rs b/third_party/move/move-model/src/builder/module_builder.rs index 8c5fe852280d9..c6d4e20ae5e58 100644 --- a/third_party/move/move-model/src/builder/module_builder.rs +++ b/third_party/move/move-model/src/builder/module_builder.rs @@ -501,6 +501,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { loc: loc.clone(), oper: Operation::SpecFunction(self.module_id, spec_fun_id, None), type_params: type_params.clone(), + type_param_constraints: BTreeMap::default(), params: params.clone(), result_type: result_type.clone(), visibility: EntryVisibility::Spec, @@ -584,6 +585,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { loc: loc.clone(), oper: Operation::SpecFunction(self.module_id, fun_id, None), type_params: type_params.clone(), + type_param_constraints: BTreeMap::default(), params: params.clone(), result_type: result_type.clone(), visibility: EntryVisibility::Spec, diff --git a/third_party/move/move-model/src/ty.rs b/third_party/move/move-model/src/ty.rs index e209f635ac212..06c0c883bbd7e 100644 --- a/third_party/move/move-model/src/ty.rs +++ b/third_party/move/move-model/src/ty.rs @@ -94,7 +94,8 @@ pub struct Substitution { /// A constraint on a type variable, maintained during unification. #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum Constraint { - /// The type variable must be instantiated with one of the given numbber types. This is used + /// Combination + /// The type variable must be instantiated with one of the given number types. This is used /// for representing integer constants. SomeNumber(BTreeSet), /// The type variable must be instantiated with a reference of given type. @@ -108,7 +109,7 @@ pub enum Constraint { impl Constraint { /// Returns the default type of a constraint. A the end of type unification, variables /// with constraints that have defaults will be substituted by those defaults. - fn default_type(&self) -> Option { + pub fn default_type(&self) -> Option { match self { Constraint::SomeNumber(options) if options.contains(&PrimitiveType::U64) => { Some(Type::new_prim(PrimitiveType::U64)) @@ -121,6 +122,54 @@ impl Constraint { _ => None, } } + + /// Joins the two constraints. If they are incompatible, produces a type unification error. + /// Otherwise returns true if the constraint has been absorbed by the other and can be waived. + pub fn join(&mut self, loc: &Loc, other: &Constraint) -> Result { + match (&mut *self, other) { + (Constraint::SomeNumber(opts1), Constraint::SomeNumber(opts2)) => { + let joined: BTreeSet = opts1.intersection(opts2).cloned().collect(); + if joined.is_empty() { + Err(TypeUnificationError::ConstraintsIncompatible( + loc.clone(), + self.clone(), + other.clone(), + )) + } else { + *opts1 = joined; + Ok(true) + } + }, + (Constraint::WithDefault(_), _) | (_, Constraint::WithDefault(_)) => Ok(false), + (_, _) => Err(TypeUnificationError::ConstraintsIncompatible( + loc.clone(), + self.clone(), + other.clone(), + )), + } + } + + pub fn display(&self, display_context: &TypeDisplayContext) -> String { + match self { + Constraint::SomeNumber(options) => { + let all_ints = PrimitiveType::all_int_types() + .into_iter() + .collect::>(); + if options == &all_ints { + "integer".to_owned() + } else { + options + .iter() + .map(|p| Type::new_prim(*p).display(display_context).to_string()) + .join("|") + } + }, + Constraint::SomeReference(ty) => { + format!("&{}", ty.display(display_context)) + }, + Constraint::WithDefault(_ty) => "".to_owned(), + } + } } /// Represents an error resulting from type unification. @@ -132,6 +181,7 @@ pub enum TypeUnificationError { MutabilityMismatch(ReferenceKind, ReferenceKind), ConstraintUnsatisfied(Loc, Type, WideningOrder, Constraint), RedirectedError(Loc, Box), + ConstraintsIncompatible(Loc, Constraint, Constraint), } impl PrimitiveType { @@ -161,7 +211,7 @@ impl PrimitiveType { }) } - /// Infer a type from a value. Returns the smallest type from u64 onwards which can fit the + /// Infer a type from a value. Returns the set of int types which can fit the /// value. pub fn possible_int_types(value: BigInt) -> Vec { Self::all_int_types() @@ -773,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 { @@ -784,12 +844,31 @@ impl Substitution { } } - /// Add a constraint to the variable. - pub fn add_constraint(&mut self, var: u32, loc: Loc, order: WideningOrder, c: Constraint) { - self.constraints - .entry(var) - .or_default() - .push((loc, order, c)); + /// Add a constraint to the variable. This tries to first join the constraint with existing + /// ones. For instance `SomeNumber({u8, u16})` and `SomeNumber({u16,u32})` join as + /// `SomeNumber({u16})`. A TypeUnificationError is returned if the constraints are incompatible. + pub fn add_constraint( + &mut self, + var: u32, + loc: Loc, + order: WideningOrder, + ctr: Constraint, + ) -> Result<(), TypeUnificationError> { + let current = self.constraints.entry(var).or_default(); + let mut absorbed = false; + for (_, o, c) in current.iter_mut() { + // If the orders are compatible, try to join constraints + if *o == order { + absorbed = c.join(&loc, &ctr)?; + if absorbed { + break; + } + } + } + if !absorbed { + current.push((loc, order, ctr)) + } + Ok(()) } /// Returns true if this is a free variable without constraints. @@ -818,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); @@ -836,7 +923,7 @@ impl Substitution { /// are over shallow structure of types, they can be decided. pub fn eval_constraint( &mut self, - loc: Loc, + loc: &Loc, ty: &Type, order: WideningOrder, c: Constraint, @@ -845,29 +932,34 @@ impl Substitution { Ok(()) } else if let Type::Var(other_var) = ty { // Transfer constraint on to other variable, which we assert to be free - assert!(!self.subs.contains_key(other_var)); - self.add_constraint(*other_var, loc, order, c); - Ok(()) + debug_assert!(!self.subs.contains_key(other_var)); + self.add_constraint(*other_var, loc.clone(), order, c) } else { match &c { Constraint::SomeNumber(options) => match ty { Type::Primitive(prim) if options.contains(prim) => Ok(()), - _ => Err(TypeUnificationError::ConstraintUnsatisfied( - loc, - 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) => { match self.unify(Variance::NoVariance, order, target_type, inner_type) { Ok(_) => Ok(()), - Err(e) => Err(TypeUnificationError::RedirectedError(loc, Box::new(e))), + Err(e) => Err(TypeUnificationError::RedirectedError( + loc.clone(), + Box::new(e), + )), } }, _ => Err(TypeUnificationError::ConstraintUnsatisfied( - loc, + loc.clone(), ty.clone(), order, c, @@ -1137,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( @@ -1368,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. @@ -1403,22 +1492,12 @@ impl TypeUnificationError { format!("mutability mismatch ({} != {})", pr(*k1), pr(*k2)) }, TypeUnificationError::ConstraintUnsatisfied(_, ty, order, constr) => match constr { - Constraint::SomeNumber(options) => { - let all_ints = PrimitiveType::all_int_types() - .into_iter() - .collect::>(); - let options_str = if options == &all_ints { - "integer".to_owned() - } else { - options - .iter() - .map(|p| Type::new_prim(*p).display(display_context).to_string()) - .join("|") - }; + Constraint::SomeNumber(_) => { + let options_str = constr.display(display_context); let type_str = ty.display(display_context).to_string(); let (expected, actual) = match order { - WideningOrder::Join | WideningOrder::LeftToRight => (type_str, options_str), - WideningOrder::RightToLeft => (options_str, type_str), + WideningOrder::Join | WideningOrder::LeftToRight => (options_str, type_str), + WideningOrder::RightToLeft => (type_str, options_str), }; format!("expected `{}` but found `{}`", expected, actual) }, @@ -1430,6 +1509,13 @@ impl TypeUnificationError { }, Constraint::WithDefault(_) => unreachable!("default constraint in error message"), }, + TypeUnificationError::ConstraintsIncompatible(_, c1, c2) => { + format!( + "constraint `{}` incompatible with `{}`", + c1.display(display_context), + c2.display(display_context) + ) + }, TypeUnificationError::RedirectedError(_, err) => err.message(display_context), } } 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; - │ ^^^^^^^^ + │ ^^^^ diff --git a/third_party/move/tools/move-cli/src/base/test.rs b/third_party/move/tools/move-cli/src/base/test.rs index 36d5a68958244..ba5f77545bec3 100644 --- a/third_party/move/tools/move-cli/src/base/test.rs +++ b/third_party/move/tools/move-cli/src/base/test.rs @@ -13,14 +13,16 @@ use move_compiler::{ PASS_CFGIR, }; use move_coverage::coverage_map::{output_map_to_file, CoverageMap}; -// if windows -use move_package::compilation::compiled_package::unimplemented_v2_driver; -use move_package::{compilation::build_plan::BuildPlan, BuildConfig, CompilerConfig}; +use move_package::{ + compilation::{build_plan::BuildPlan, compiled_package::unimplemented_v2_driver}, + BuildConfig, CompilerConfig, +}; use move_unit_test::UnitTestingConfig; use move_vm_test_utils::gas_schedule::CostTable; // if unix #[cfg(target_family = "unix")] use std::os::unix::prelude::ExitStatusExt; +// if windows #[cfg(target_family = "windows")] use std::os::windows::process::ExitStatusExt; use std::{