diff options
author | chriseth <chris@ethereum.org> | 2018-07-18 18:08:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-18 18:08:42 +0800 |
commit | b909df4573130e020c7f4dfb61c0571ba1bc02ab (patch) | |
tree | c5657726547d314fef6e80af702d061275afe5c7 /test | |
parent | 1d33f41c1ab96746b97b97f79732ec23759fb8f0 (diff) | |
parent | 8b827af5bf4ed52c9612bcf1bdadb25ca7b879bf (diff) | |
download | dexon-solidity-b909df4573130e020c7f4dfb61c0571ba1bc02ab.tar.gz dexon-solidity-b909df4573130e020c7f4dfb61c0571ba1bc02ab.tar.zst dexon-solidity-b909df4573130e020c7f4dfb61c0571ba1bc02ab.zip |
Merge pull request #4430 from ethereum/enforceVisibilitySpecifier
[BREAKING] Enforce visibility specifier
Diffstat (limited to 'test')
10 files changed, 19 insertions, 28 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 0fe21c4a..d8f2f531 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -670,7 +670,7 @@ BOOST_AUTO_TEST_CASE(nested_loops_multiple_local_vars) // and free local variables properly char const* sourceCode = R"( contract test { - function f(uint x) returns(uint y) { + function f(uint x) public returns(uint y) { while (x > 0) { uint z = x + 10; uint k = z + 1; @@ -9536,7 +9536,7 @@ BOOST_AUTO_TEST_CASE(continue_in_modifier) _; } } - function f() run { + function f() run public { uint k = x; uint t = k + 1; x = t; @@ -9560,7 +9560,7 @@ BOOST_AUTO_TEST_CASE(return_in_modifier) _; } } - function f() run { + function f() run public { uint k = x; uint t = k + 1; x = t; diff --git a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol index 88553084..586329b1 100644 --- a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol +++ b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol @@ -1,3 +1,3 @@ contract A { constructor() {} } // ---- -// Warning: (13-29): No visibility specified. Defaulting to "public". +// SyntaxError: (13-29): No visibility specified. Did you intend to add "public"? diff --git a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility_050.sol b/test/libsolidity/syntaxTests/constructor/constructor_no_visibility_050.sol deleted file mode 100644 index 0f57a41f..00000000 --- a/test/libsolidity/syntaxTests/constructor/constructor_no_visibility_050.sol +++ /dev/null @@ -1,4 +0,0 @@ -pragma experimental "v0.5.0"; -contract A { constructor() {} } -// ---- -// SyntaxError: (43-59): No visibility specified. diff --git a/test/libsolidity/syntaxTests/fallback/default_visibility.sol b/test/libsolidity/syntaxTests/fallback/default_visibility.sol index 31123d59..6fbb15a5 100644 --- a/test/libsolidity/syntaxTests/fallback/default_visibility.sol +++ b/test/libsolidity/syntaxTests/fallback/default_visibility.sol @@ -3,4 +3,5 @@ contract C { function() {} } // ---- +// SyntaxError: (90-103): No visibility specified. Did you intend to add "external"? // TypeError: (90-103): Fallback function must be defined as "external". diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/567_require_visibility_specifiers_v050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/567_require_visibility_specifiers_v050.sol deleted file mode 100644 index ec7c0937..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/567_require_visibility_specifiers_v050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() pure { } -} -// ---- -// SyntaxError: (47-68): No visibility specified. diff --git a/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol b/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol index ecc36f04..4fc7900f 100644 --- a/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol +++ b/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol @@ -2,4 +2,4 @@ contract C { function f() pure { } } // ---- -// Warning: (17-38): No visibility specified. Defaulting to "public". +// SyntaxError: (17-38): No visibility specified. Did you intend to add "public"? diff --git a/test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol b/test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol deleted file mode 100644 index ec7c0937..00000000 --- a/test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol +++ /dev/null @@ -1,6 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() pure { } -} -// ---- -// SyntaxError: (47-68): No visibility specified. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol index 161d66e1..b7e96e5e 100644 --- a/test/libsolidity/syntaxTests/visibility/interface/function_default.sol +++ b/test/libsolidity/syntaxTests/visibility/interface/function_default.sol @@ -2,4 +2,5 @@ interface I { function f(); } // ---- +// SyntaxError: (15-28): No visibility specified. Did you intend to add "external"? // TypeError: (15-28): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol b/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol deleted file mode 100644 index 513df26b..00000000 --- a/test/libsolidity/syntaxTests/visibility/interface/function_default050.sol +++ /dev/null @@ -1,7 +0,0 @@ -pragma experimental "v0.5.0"; -interface I { - function f(); -} -// ---- -// SyntaxError: (45-58): No visibility specified. -// TypeError: (45-58): Functions in interfaces must be declared external. diff --git a/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol b/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol new file mode 100644 index 00000000..b1a820ed --- /dev/null +++ b/test/libsolidity/syntaxTests/visibility/interface/interface_contract_function_default.sol @@ -0,0 +1,12 @@ +// State of the syntax checker has to be reset after the interface +// was visited. The suggested visibility for g() should not be external. +interface I { + function f(); +} +contract C { + function g(); +} +// ---- +// SyntaxError: (158-171): No visibility specified. Did you intend to add "external"? +// SyntaxError: (191-204): No visibility specified. Did you intend to add "public"? +// TypeError: (158-171): Functions in interfaces must be declared external. |