From cd83d09cf33f5e151d0fec75871cdb3066df56d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Wed, 18 Jan 2023 14:13:27 +0100 Subject: [PATCH] fixup! User-defined operators: Tests --- ...rator_with_library_function_private_at_file_level.sol | 9 +++++++++ ..._with_library_function_public_internal_or_private.sol | 4 ---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_private_at_file_level.sol diff --git a/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_private_at_file_level.sol b/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_private_at_file_level.sol new file mode 100644 index 000000000..35d8d0ab1 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_private_at_file_level.sol @@ -0,0 +1,9 @@ +type Int is int128; + +library L { + function privateOperator(Int, Int) private pure returns (Int) {} +} + +using {L.privateOperator as +} for Int; +// ---- +// TypeError 6772: (112-129): Function "L.privateOperator" is private and therefore cannot be attached to a type outside of the library where it is defined. diff --git a/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_public_internal_or_private.sol b/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_public_internal_or_private.sol index 1c66c0ae6..d814f0aba 100644 --- a/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_public_internal_or_private.sol +++ b/test/libsolidity/syntaxTests/operators/userDefined/implementing_operator_with_library_function_public_internal_or_private.sol @@ -3,11 +3,7 @@ type Int is int128; library L { function publicOperator(Int, Int) public pure returns (Int) {} function internalOperator(Int, Int) internal pure returns (Int) {} - function privateOperator(Int, Int) private pure returns (Int) {} } using {L.publicOperator as +} for Int; using {L.internalOperator as +} for Int; -// FIXME: Being able to use private library functions in a file-level 'using for' is a bug. -// See: https://github.com/ethereum/solidity/issues/13764 -using {L.privateOperator as +} for Int;