diff --git a/test/libsolidity/semanticTests/operators/custom/bind_same_function_to_multiple_operators.sol b/test/libsolidity/semanticTests/operators/custom/bind_same_function_to_multiple_operators.sol index 208bdc099..2cb87602f 100644 --- a/test/libsolidity/semanticTests/operators/custom/bind_same_function_to_multiple_operators.sol +++ b/test/libsolidity/semanticTests/operators/custom/bind_same_function_to_multiple_operators.sol @@ -2,20 +2,20 @@ type Int is int32; using {foo as +, foo as -} for Int; -function foo(Int, Int) pure returns(Int) { - return Int.wrap(7); +function foo(Int a, Int b) pure returns(Int) { + return Int.wrap(Int.unwrap(a) + Int.unwrap(b)); } contract C { function f() pure public returns (Int) { - return Int.wrap(0) + Int.wrap(0); + return Int.wrap(2) + Int.wrap(3); } function g() pure public returns (Int) { - return Int.wrap(0) - Int.wrap(0); + return Int.wrap(6) - Int.wrap(1); } } // ---- -// f() -> 7 +// f() -> 5 // g() -> 7 diff --git a/test/libsolidity/semanticTests/operators/custom/external_call_inside_operator_function.sol b/test/libsolidity/semanticTests/operators/custom/external_call_inside_operator_function.sol index d82f9ccb3..e55449cac 100644 --- a/test/libsolidity/semanticTests/operators/custom/external_call_inside_operator_function.sol +++ b/test/libsolidity/semanticTests/operators/custom/external_call_inside_operator_function.sol @@ -9,8 +9,10 @@ function add(Int, Int) returns (Int) { } contract B { - function f() pure external returns (Int) { - return Int.wrap(3); + Int s; + function f() external returns (Int) { + s = Int.wrap(3); + return s; } } diff --git a/test/libsolidity/semanticTests/operators/custom/operator_bound_for_two_types.sol b/test/libsolidity/semanticTests/operators/custom/operator_bound_for_two_types.sol index 40a954481..eccacdcd2 100644 --- a/test/libsolidity/semanticTests/operators/custom/operator_bound_for_two_types.sol +++ b/test/libsolidity/semanticTests/operators/custom/operator_bound_for_two_types.sol @@ -1,27 +1,27 @@ type SmallInt is int; type BigInt is int; -using {add1 as +} for SmallInt; -using {add2 as +} for BigInt; +using {addSmall as +} for SmallInt; +using {addBig as +} for BigInt; -function add1(SmallInt, SmallInt) pure returns (SmallInt) { - return SmallInt.wrap(1); +function addSmall(SmallInt a, SmallInt b) pure returns (SmallInt) { + return SmallInt.wrap(SmallInt.unwrap(a) + SmallInt.unwrap(b)); } -function add2(BigInt, BigInt) pure returns (BigInt) { - return BigInt.wrap(2); +function addBig(BigInt a, BigInt b) pure returns (BigInt) { + return BigInt.wrap(10 * (BigInt.unwrap(a) + BigInt.unwrap(b))); } contract C { - function f() public pure returns (SmallInt) { - return SmallInt.wrap(0) + SmallInt.wrap(0); + function small() public pure returns (SmallInt) { + return SmallInt.wrap(1) + SmallInt.wrap(2); } - function g() public pure returns (BigInt) { - return BigInt.wrap(0) + BigInt.wrap(0); + function big() public pure returns (BigInt) { + return BigInt.wrap(3) + BigInt.wrap(4); } } // ---- -// f() -> 1 -// g() -> 2 +// small() -> 3 +// big() -> 70 diff --git a/test/libsolidity/semanticTests/operators/custom/operator_bound_to_library_function.sol b/test/libsolidity/semanticTests/operators/custom/operator_bound_to_library_function.sol index c36fe2ed3..dcf7e0c11 100644 --- a/test/libsolidity/semanticTests/operators/custom/operator_bound_to_library_function.sol +++ b/test/libsolidity/semanticTests/operators/custom/operator_bound_to_library_function.sol @@ -26,8 +26,6 @@ contract C { } } -// ==== -// compileViaYul: also // ---- // f() -> 7 // g() -> 5 diff --git a/test/libsolidity/semanticTests/operators/custom/redefine_operator_bind_in_derived_contract.sol b/test/libsolidity/semanticTests/operators/custom/redefine_operator_bind_in_derived_contract.sol index 81f08ade6..98ada9e2b 100644 --- a/test/libsolidity/semanticTests/operators/custom/redefine_operator_bind_in_derived_contract.sol +++ b/test/libsolidity/semanticTests/operators/custom/redefine_operator_bind_in_derived_contract.sol @@ -1,29 +1,42 @@ type Int is int128; -function add(Int, Int) pure returns (Int) { +function addA(Int, Int) pure returns (Int) { + return Int.wrap(1); +} + +function addB(Int, Int) pure returns (Int) { return Int.wrap(3); } -function another_add(Int, Int) pure returns (Int) { +function addC(Int, Int) pure returns (Int) { return Int.wrap(7); } -contract B { - using {add as +} for Int; +contract A { + using {addA as +} for Int; - function f() pure public returns (Int) { + function testA() pure public returns (Int) { return Int.wrap(0) + Int.wrap(0); } } -contract C is B { - using {another_add as +} for Int; +contract B is A { + using {addB as +} for Int; - function g() pure public returns (Int) { + function testB() pure public returns (Int) { + return Int.wrap(0) + Int.wrap(0); + } +} + +contract C is A, B { + using {addC as +} for Int; + + function testC() pure public returns (Int) { return Int.wrap(0) + Int.wrap(0); } } // ---- -// f() -> 3 -// g() -> 7 +// testA() -> 1 +// testB() -> 3 +// testC() -> 7