From 7723f90a077dc62c6b9aa7375d149dd83e88206c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 24 Jan 2023 18:14:39 +0100 Subject: [PATCH] fixup! User-defined operators: Tests --- ...g_operator_with_privately_overloaded_function.sol | 12 ++++++++++++ ...nctions_and_defining_operators_same_directive.sol | 10 ++++++++++ 2 files changed, 22 insertions(+) create mode 100644 test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_privately_overloaded_function.sol create mode 100644 test/libsolidity/syntaxTests/operators/userDefined/using_for_attaching_functions_and_defining_operators_same_directive.sol diff --git a/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_privately_overloaded_function.sol b/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_privately_overloaded_function.sol new file mode 100644 index 000000000..102dfc674 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_privately_overloaded_function.sol @@ -0,0 +1,12 @@ +using {L.add as +} for A; +using {L.add as +} for AP; + +library L { + function add(A, A) private pure returns (A) {} + function add(AP, AP) internal pure returns (AP) {} +} + +type A is address; +type AP is address payable; +// ---- +// DeclarationError 7920: (7-12): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/operators/userDefined/using_for_attaching_functions_and_defining_operators_same_directive.sol b/test/libsolidity/syntaxTests/operators/userDefined/using_for_attaching_functions_and_defining_operators_same_directive.sol new file mode 100644 index 000000000..9b83faa59 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/userDefined/using_for_attaching_functions_and_defining_operators_same_directive.sol @@ -0,0 +1,10 @@ +type AP is address payable; + +function sub(AP, AP) pure returns (AP) {} +function unsub(AP) pure returns (AP) {} + +function attachedPure(AP, uint, address) pure {} +function attachedView(AP) view {} +function attached(AP, function(AP)) {} + +using {sub as -, attachedPure, attachedView, unsub as -, attached} for AP;