From 4f611fbf17d7f60794bb24f4f1215127a40c8d66 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 23 Jul 2020 14:57:41 +0200 Subject: [PATCH] Some more tests for value. --- .../error_deprecate_value_constructor_nonpayable.sol | 11 +++++++++++ .../call_option_value_on_library_function.sol | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol create mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol diff --git a/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol new file mode 100644 index 000000000..4cc674570 --- /dev/null +++ b/test/libsolidity/syntaxTests/functionTypes/error_deprecate_value_constructor_nonpayable.sol @@ -0,0 +1,11 @@ +contract C { + constructor() {} +} +contract D { + function createC() public returns (C) { + C c = (new C).value(2)(); + return c; + } +} +// ---- +// TypeError 8827: (107-120): Constructor for contract C must be payable for member "value" to be available. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol new file mode 100644 index 000000000..a5b57253a --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/call_option_value_on_library_function.sol @@ -0,0 +1,8 @@ +library L { function l() public {} } +contract test { + function f() public { + L.l{value: 1}(); + } +} +// ---- +// TypeError 2193: (87-100): Function call options can only be set on external function calls or contract creations.