From b5f61285b75852a5db9c64ddd648f5be2ca7a0f1 Mon Sep 17 00:00:00 2001 From: wechman Date: Mon, 8 Aug 2022 11:09:14 +0200 Subject: [PATCH] Test cases for bindng operators to builtin functions --- .../operators/custom/bind_encode_function.sol | 10 ++++++++++ .../syntaxTests/operators/custom/bind_event.sol | 8 ++++++++ .../operators/custom/bind_keccak_function.sol | 6 ++++++ .../operators/custom/bind_revert_function.sol | 6 ++++++ 4 files changed, 30 insertions(+) create mode 100644 test/libsolidity/syntaxTests/operators/custom/bind_encode_function.sol create mode 100644 test/libsolidity/syntaxTests/operators/custom/bind_event.sol create mode 100644 test/libsolidity/syntaxTests/operators/custom/bind_keccak_function.sol create mode 100644 test/libsolidity/syntaxTests/operators/custom/bind_revert_function.sol diff --git a/test/libsolidity/syntaxTests/operators/custom/bind_encode_function.sol b/test/libsolidity/syntaxTests/operators/custom/bind_encode_function.sol new file mode 100644 index 000000000..5637c62f1 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/custom/bind_encode_function.sol @@ -0,0 +1,10 @@ +type Int is int16; + +using {abi.encode as +} for Int; + +function f(Int, Int) pure returns (Int) { + return Int.wrap(0); +} + +// ---- +// DeclarationError 7920: (27-37): Identifier not found or not unique. diff --git a/test/libsolidity/syntaxTests/operators/custom/bind_event.sol b/test/libsolidity/syntaxTests/operators/custom/bind_event.sol new file mode 100644 index 000000000..14a289053 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/custom/bind_event.sol @@ -0,0 +1,8 @@ +type Int is int16; + +using {IntError as +} for Int; + +error IntError(Int a, Int b); + +// ---- +// TypeError 8187: (27-35): Expected function name. diff --git a/test/libsolidity/syntaxTests/operators/custom/bind_keccak_function.sol b/test/libsolidity/syntaxTests/operators/custom/bind_keccak_function.sol new file mode 100644 index 000000000..3478d99b0 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/custom/bind_keccak_function.sol @@ -0,0 +1,6 @@ +type Int is int16; + +using {keccak256 as +} for Int; + +// ---- +// TypeError 8187: (27-36): Expected function name. diff --git a/test/libsolidity/syntaxTests/operators/custom/bind_revert_function.sol b/test/libsolidity/syntaxTests/operators/custom/bind_revert_function.sol new file mode 100644 index 000000000..bae572525 --- /dev/null +++ b/test/libsolidity/syntaxTests/operators/custom/bind_revert_function.sol @@ -0,0 +1,6 @@ +type Int is int16; + +using {revert as +} for Int; + +// ---- +// DeclarationError 7920: (27-33): Identifier not found or not unique.