aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-07-02 19:06:59 +0800
committerGitHub <noreply@github.com>2018-07-02 19:06:59 +0800
commit9a71b69f4009d6e0ccac715648b06994ef321d3f (patch)
treecb86c07d714f427a07150ef8d97143c1c864eefb /test/libsolidity
parent8a4980c05ef7d3408dfb138b17b1610ef648d441 (diff)
parent1b008c62a1e2475fe0fc160150dca482009912d1 (diff)
downloaddexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.tar
dexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.tar.gz
dexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.tar.bz2
dexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.tar.lz
dexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.tar.xz
dexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.tar.zst
dexon-solidity-9a71b69f4009d6e0ccac715648b06994ef321d3f.zip
Merge pull request #4386 from ethereum/testingDefaultVisibility
Specify default visibility in syntax tests
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/040_functions_with_different_structs_in_interface.sol6
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol4
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol11
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol11
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol5
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/423_using_interface.sol4
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol11
-rw-r--r--test/libsolidity/syntaxTests/parsing/calling_function.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/conditional_multiple.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol9
-rw-r--r--test/libsolidity/syntaxTests/parsing/else_if_statement.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/empty_function.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/exp_expression.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_no_body.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_normal_comments.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol14
-rw-r--r--test/libsolidity/syntaxTests/parsing/if_statement.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/inline_array_declaration.sol3
-rw-r--r--test/libsolidity/syntaxTests/parsing/interface_basic.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/library_simple.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol4
-rw-r--r--test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol11
-rw-r--r--test/libsolidity/syntaxTests/parsing/modifier_invocation.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol34
-rw-r--r--test/libsolidity/syntaxTests/parsing/no_function_params.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/overloaded_functions.sol10
-rw-r--r--test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol5
-rw-r--r--test/libsolidity/syntaxTests/parsing/single_function_param.sol7
-rw-r--r--test/libsolidity/syntaxTests/parsing/tuples.sol15
-rw-r--r--test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol11
-rw-r--r--test/libsolidity/syntaxTests/visibility/function_no_visibility.sol (renamed from test/libsolidity/syntaxTests/nameAndTypeResolution/566_require_visibility_specifiers.sol)0
-rw-r--r--test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol6
43 files changed, 136 insertions, 189 deletions
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/040_functions_with_different_structs_in_interface.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/040_functions_with_different_structs_in_interface.sol
index 2af584b7..1689e6f5 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/040_functions_with_different_structs_in_interface.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/040_functions_with_different_structs_in_interface.sol
@@ -3,10 +3,8 @@ pragma experimental ABIEncoderV2;
contract C {
struct S1 { function() external a; }
struct S2 { bytes24 a; }
- function f(S1) pure {}
- function f(S2) pure {}
+ function f(S1) public pure {}
+ function f(S2) public pure {}
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
-// Warning: (122-144): No visibility specified. Defaulting to "public".
-// Warning: (149-171): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol
index 3fd7a0cb..98bc8e66 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/124_enum_member_access.sol
@@ -1,10 +1,8 @@
contract test {
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
- constructor()
+ constructor() public
{
choices = ActionChoices.GoStraight;
}
ActionChoices choices;
}
-// ----
-// Warning: (80-149): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
index ae260ce4..0da5c7ee 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/239_multi_variable_declaration_wildcards_fine.sol
@@ -1,7 +1,7 @@
contract C {
function three() public returns (uint, uint, uint);
function two() public returns (uint, uint);
- function none();
+ function none() public;
function f() public {
(uint a,) = three();
(uint b, uint c,) = two();
@@ -13,8 +13,7 @@ contract C {
}
}
// ----
-// Warning: (172-191): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (201-226): Different number of components on the left hand side (3) than on the right hand side (2).
-// Warning: (236-255): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (265-290): Different number of components on the left hand side (3) than on the right hand side (2).
-// Warning: (121-137): No visibility specified. Defaulting to "public".
+// Warning: (179-198): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (208-233): Different number of components on the left hand side (3) than on the right hand side (2).
+// Warning: (243-262): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (272-297): Different number of components on the left hand side (3) than on the right hand side (2).
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol
index 0ff1ed75..97e68aa3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol
@@ -1,7 +1,4 @@
- contract M {
- function f(uint[]);
- function f(int[]);
- }
-// ----
-// Warning: (25-44): No visibility specified. Defaulting to "public".
-// Warning: (53-71): No visibility specified. Defaulting to "public".
+contract M {
+ function f(uint[]) public;
+ function f(int[]) public;
+}
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol
index e69c2934..bdf033a3 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/275_inline_struct_declaration_arrays.sol
@@ -3,11 +3,10 @@ contract C {
uint a;
string b;
}
- function f() {
+ function f() public {
S[2] memory x = [S({a: 1, b: "fish"}), S({a: 2, b: "fish"})];
}
}
// ----
-// Warning: (72-162): No visibility specified. Defaulting to "public".
-// Warning: (95-108): Unused local variable.
-// Warning: (72-162): Function state mutability can be restricted to pure
+// Warning: (102-115): Unused local variable.
+// Warning: (72-169): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol
index 5583dbff..8af8098c 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/403_return_structs.sol
@@ -2,10 +2,9 @@ pragma experimental ABIEncoderV2;
contract C {
struct S { uint a; T[] sub; }
struct T { uint[] x; }
- function f() returns (uint, S) {
+ function f() public returns (uint, S) {
}
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
-// Warning: (112-150): No visibility specified. Defaulting to "public".
-// Warning: (112-150): Function state mutability can be restricted to pure
+// Warning: (112-157): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/423_using_interface.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/423_using_interface.sol
index f06ffa62..d576bb60 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/423_using_interface.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/423_using_interface.sol
@@ -1,10 +1,8 @@
interface I {
- function f();
+ function f() external;
}
contract C is I {
function f() public {
}
}
// ----
-// Warning: (18-31): Functions in interfaces should be declared external.
-// Warning: (18-31): No visibility specified. Defaulting to "public". In interfaces it defaults to external.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol
index 35f4639e..157ea36b 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/535_address_overload_resolution.sol
@@ -1,21 +1,18 @@
contract C {
- function balance() returns (uint) {
+ function balance() public returns (uint) {
this.balance; // to avoid pureness warning
return 1;
}
- function transfer(uint amount) {
+ function transfer(uint amount) public {
address(this).transfer(amount); // to avoid pureness warning
}
}
contract D {
- function f() {
+ function f() public {
uint x = (new C()).balance();
x;
(new C()).transfer(5);
}
}
// ----
-// Warning: (17-127): No visibility specified. Defaulting to "public".
-// Warning: (132-239): No visibility specified. Defaulting to "public".
-// Warning: (259-359): No visibility specified. Defaulting to "public".
-// Warning: (17-127): Function state mutability can be restricted to view
+// Warning: (17-134): Function state mutability can be restricted to view
diff --git a/test/libsolidity/syntaxTests/parsing/calling_function.sol b/test/libsolidity/syntaxTests/parsing/calling_function.sol
index 4c4fc1fc..9e88c451 100644
--- a/test/libsolidity/syntaxTests/parsing/calling_function.sol
+++ b/test/libsolidity/syntaxTests/parsing/calling_function.sol
@@ -1,9 +1,7 @@
contract test {
- function f() {
+ function f() public {
function() returns(function() returns(function() returns(function() returns(uint)))) x;
uint y;
y = x()()()();
}
}
-// ----
-// Warning: (20-175): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol b/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol
index c7d11ed6..0e348f5b 100644
--- a/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol
+++ b/test/libsolidity/syntaxTests/parsing/conditional_multiple.sol
@@ -1,9 +1,8 @@
contract A {
- function f() {
+ function f() public {
uint x = 3 < 0 ? 2 > 1 ? 2 : 1 : 7 > 2 ? 7 : 6;
}
}
// ----
-// Warning: (17-93): No visibility specified. Defaulting to "public".
-// Warning: (40-46): Unused local variable.
-// Warning: (17-93): Function state mutability can be restricted to pure
+// Warning: (47-53): Unused local variable.
+// Warning: (17-100): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol b/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol
index 90974e96..40aaa917 100644
--- a/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol
+++ b/test/libsolidity/syntaxTests/parsing/conditional_true_false_literal.sol
@@ -1,11 +1,10 @@
contract A {
- function f() {
+ function f() public {
uint x = true ? 1 : 0;
uint y = false ? 0 : 1;
}
}
// ----
-// Warning: (17-100): No visibility specified. Defaulting to "public".
-// Warning: (40-46): Unused local variable.
-// Warning: (71-77): Unused local variable.
-// Warning: (17-100): Function state mutability can be restricted to pure
+// Warning: (47-53): Unused local variable.
+// Warning: (78-84): Unused local variable.
+// Warning: (17-107): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol b/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol
index 35da69c6..705fbadf 100644
--- a/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol
+++ b/test/libsolidity/syntaxTests/parsing/conditional_with_constants.sol
@@ -1,11 +1,10 @@
contract A {
- function f() {
+ function f() public {
uint x = 3 > 0 ? 3 : 0;
uint y = (3 > 0) ? 3 : 0;
}
}
// ----
-// Warning: (17-103): No visibility specified. Defaulting to "public".
-// Warning: (40-46): Unused local variable.
-// Warning: (72-78): Unused local variable.
-// Warning: (17-103): Function state mutability can be restricted to pure
+// Warning: (47-53): Unused local variable.
+// Warning: (79-85): Unused local variable.
+// Warning: (17-110): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol b/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol
index eb4c7091..bbabf957 100644
--- a/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol
+++ b/test/libsolidity/syntaxTests/parsing/conditional_with_variables.sol
@@ -1,5 +1,5 @@
contract A {
- function f() {
+ function f() public {
uint x = 3;
uint y = 1;
uint z = (x > y) ? x : y;
@@ -7,7 +7,6 @@ contract A {
}
}
// ----
-// Warning: (17-143): No visibility specified. Defaulting to "public".
-// Warning: (80-86): Unused local variable.
-// Warning: (114-120): Unused local variable.
-// Warning: (17-143): Function state mutability can be restricted to pure
+// Warning: (87-93): Unused local variable.
+// Warning: (121-127): Unused local variable.
+// Warning: (17-150): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol
index 8be9667a..6d88669a 100644
--- a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol
+++ b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol
@@ -1,14 +1,13 @@
contract A {
fixed40x40 storeMe;
- function f(ufixed x, fixed32x32 y) {
+ function f(ufixed x, fixed32x32 y) public {
ufixed8x8 a;
fixed b;
}
}
// ----
-// Warning: (41-121): No visibility specified. Defaulting to "public".
// Warning: (52-60): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (62-74): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (86-97): Unused local variable.
-// Warning: (107-114): Unused local variable.
-// Warning: (41-121): Function state mutability can be restricted to pure
+// Warning: (93-104): Unused local variable.
+// Warning: (114-121): Unused local variable.
+// Warning: (41-128): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/else_if_statement.sol b/test/libsolidity/syntaxTests/parsing/else_if_statement.sol
index 37763697..c2a1aaeb 100644
--- a/test/libsolidity/syntaxTests/parsing/else_if_statement.sol
+++ b/test/libsolidity/syntaxTests/parsing/else_if_statement.sol
@@ -1,8 +1,7 @@
contract test {
- function fun(uint256 a) returns (uint8 b) {
+ function fun(uint256 a) public returns (uint8 b) {
if (a < 0) b = 0x67; else if (a == 0) b = 0x12; else b = 0x78;
}
}
// ----
-// Warning: (20-140): No visibility specified. Defaulting to "public".
-// Warning: (20-140): Function state mutability can be restricted to pure
+// Warning: (20-147): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/empty_function.sol b/test/libsolidity/syntaxTests/parsing/empty_function.sol
index 218fd9a7..320a0bcc 100644
--- a/test/libsolidity/syntaxTests/parsing/empty_function.sol
+++ b/test/libsolidity/syntaxTests/parsing/empty_function.sol
@@ -1,10 +1,9 @@
contract test {
uint256 stateVar;
- function functionName(bytes20 arg1, address addr) view returns (int id) { }
+ function functionName(bytes20 arg1, address addr) public view returns (int id) { }
}
// ----
-// Warning: (36-111): No visibility specified. Defaulting to "public".
// Warning: (58-70): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (72-84): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (100-106): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (36-111): Function state mutability can be restricted to pure
+// Warning: (107-113): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (36-118): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol b/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol
index 602c26ed..606f59d7 100644
--- a/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol
+++ b/test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol
@@ -1,9 +1,7 @@
contract c {
enum validEnum { Value1, Value2, Value3, Value4 }
- constructor() {
+ constructor() public {
a = validEnum.Value3;
}
validEnum a;
}
-// ----
-// Warning: (71-122): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/parsing/exp_expression.sol b/test/libsolidity/syntaxTests/parsing/exp_expression.sol
index cdabb996..6b307ea0 100644
--- a/test/libsolidity/syntaxTests/parsing/exp_expression.sol
+++ b/test/libsolidity/syntaxTests/parsing/exp_expression.sol
@@ -1,9 +1,8 @@
contract test {
- function fun(uint256 a) {
+ function fun(uint256 a) public {
uint256 x = 3 ** a;
}
}
// ----
-// Warning: (20-79): No visibility specified. Defaulting to "public".
-// Warning: (54-63): Unused local variable.
-// Warning: (20-79): Function state mutability can be restricted to pure
+// Warning: (61-70): Unused local variable.
+// Warning: (20-86): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol
index bd86f2f5..fce669dd 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_simple_initexpr.sol
@@ -1,5 +1,5 @@
contract test {
- function fun(uint256 a) {
+ function fun(uint256 a) public {
uint256 i =0;
for (i = 0; i < 10; i++) {
uint256 x = i; break; continue;
@@ -7,7 +7,6 @@ contract test {
}
}
// ----
-// Warning: (20-162): No visibility specified. Defaulting to "public".
// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (115-124): Unused local variable.
-// Warning: (20-162): Function state mutability can be restricted to pure
+// Warning: (122-131): Unused local variable.
+// Warning: (20-169): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol
index 4a27e0fb..4adf0948 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_simple_noexpr.sol
@@ -1,5 +1,5 @@
contract test {
- function fun(uint256 a) {
+ function fun(uint256 a) public {
uint256 i =0;
for (;;) {
uint256 x = i; break; continue;
@@ -7,7 +7,6 @@ contract test {
}
}
// ----
-// Warning: (24-170): No visibility specified. Defaulting to "public".
// Warning: (37-46): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (115-124): Unused local variable.
-// Warning: (24-170): Function state mutability can be restricted to pure
+// Warning: (122-131): Unused local variable.
+// Warning: (24-177): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol b/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol
index 3df88ef5..c6af519c 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_single_stmt_body.sol
@@ -1,11 +1,10 @@
contract test {
- function fun(uint256 a) {
+ function fun(uint256 a) public {
uint256 i = 0;
for (i = 0; i < 10; i++)
continue;
}
}
// ----
-// Warning: (20-129): No visibility specified. Defaulting to "public".
// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (20-129): Function state mutability can be restricted to pure
+// Warning: (20-136): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol b/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol
index a7c5e8bb..c22ae42f 100644
--- a/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol
+++ b/test/libsolidity/syntaxTests/parsing/for_loop_vardef_initexpr.sol
@@ -1,12 +1,11 @@
contract test {
- function fun(uint256 a) {
+ function fun(uint256 a) public {
for (uint256 i = 0; i < 10; i++) {
uint256 x = i; break; continue;
}
}
}
// ----
-// Warning: (20-148): No visibility specified. Defaulting to "public".
// Warning: (33-42): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (101-110): Unused local variable.
-// Warning: (20-148): Function state mutability can be restricted to pure
+// Warning: (108-117): Unused local variable.
+// Warning: (20-155): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/function_no_body.sol b/test/libsolidity/syntaxTests/parsing/function_no_body.sol
index 0424ebd8..c4a686dc 100644
--- a/test/libsolidity/syntaxTests/parsing/function_no_body.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_no_body.sol
@@ -1,5 +1,3 @@
contract test {
- function functionName(bytes32 input) returns (bytes32 out);
+ function functionName(bytes32 input) public returns (bytes32 out);
}
-// ----
-// Warning: (17-76): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol b/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol
index c7a023ac..94e1e60a 100644
--- a/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_normal_comments.sol
@@ -1,10 +1,9 @@
contract test {
uint256 stateVar;
// We won't see this comment
- function functionName(bytes32 input) returns (bytes32 out) {}
+ function functionName(bytes32 input) public returns (bytes32 out) {}
}
// ----
-// Warning: (75-136): No visibility specified. Defaulting to "public".
// Warning: (97-110): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (121-132): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (75-136): Function state mutability can be restricted to pure
+// Warning: (128-139): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (75-143): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol
index 3b784733..11e77f25 100644
--- a/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_assignment.sol
@@ -1,10 +1,9 @@
contract test {
- function f(uint x, uint y) returns (uint a) {}
+ function f(uint x, uint y) public returns (uint a) {}
function (uint, uint) internal returns (uint) f1 = f;
}
// ----
-// Warning: (20-66): No visibility specified. Defaulting to "public".
// Warning: (31-37): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (39-45): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (56-62): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (20-66): Function state mutability can be restricted to pure
+// Warning: (63-69): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (20-73): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol b/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol
index fd6447c7..3defb5ea 100644
--- a/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol
+++ b/test/libsolidity/syntaxTests/parsing/function_type_in_expression.sol
@@ -1,15 +1,13 @@
contract test {
- function f(uint x, uint y) returns (uint a) {}
- function g() {
+ function f(uint x, uint y) public returns (uint a) {}
+ function g() public {
function (uint, uint) internal returns (uint) f1 = f;
}
}
// ----
-// Warning: (20-66): No visibility specified. Defaulting to "public".
// Warning: (31-37): Unused function parameter. Remove or comment out the variable name to silence this warning.
// Warning: (39-45): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (56-62): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (71-153): No visibility specified. Defaulting to "public".
-// Warning: (94-142): Unused local variable.
-// Warning: (20-66): Function state mutability can be restricted to pure
-// Warning: (71-153): Function state mutability can be restricted to pure
+// Warning: (63-69): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (108-156): Unused local variable.
+// Warning: (20-73): Function state mutability can be restricted to pure
+// Warning: (78-167): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/if_statement.sol b/test/libsolidity/syntaxTests/parsing/if_statement.sol
index 451fba1f..b3269785 100644
--- a/test/libsolidity/syntaxTests/parsing/if_statement.sol
+++ b/test/libsolidity/syntaxTests/parsing/if_statement.sol
@@ -1,9 +1,8 @@
contract test {
- function fun(uint256 a) returns (uint) {
+ function fun(uint256 a) public returns (uint) {
if (a >= 8) { return 2; } else { uint b = 7; }
}
}
// ----
-// Warning: (20-121): No visibility specified. Defaulting to "public".
-// Warning: (102-108): Unused local variable.
-// Warning: (20-121): Function state mutability can be restricted to pure
+// Warning: (109-115): Unused local variable.
+// Warning: (20-128): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/inline_array_declaration.sol b/test/libsolidity/syntaxTests/parsing/inline_array_declaration.sol
index f42f8f16..4730f950 100644
--- a/test/libsolidity/syntaxTests/parsing/inline_array_declaration.sol
+++ b/test/libsolidity/syntaxTests/parsing/inline_array_declaration.sol
@@ -1,9 +1,8 @@
contract c {
uint[] a;
- function f() returns (uint, uint) {
+ function f() public returns (uint, uint) {
a = [1,2,3];
return (a[3], [2,3,4][0]);
}
}
// ----
-// Warning: (31-128): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/parsing/interface_basic.sol b/test/libsolidity/syntaxTests/parsing/interface_basic.sol
index c25b48ba..2363eaa8 100644
--- a/test/libsolidity/syntaxTests/parsing/interface_basic.sol
+++ b/test/libsolidity/syntaxTests/parsing/interface_basic.sol
@@ -1,6 +1,5 @@
interface Interface {
- function f();
+ function f() public;
}
// ----
-// Warning: (23-36): Functions in interfaces should be declared external.
-// Warning: (23-36): No visibility specified. Defaulting to "public". In interfaces it defaults to external.
+// Warning: (23-43): Functions in interfaces should be declared external.
diff --git a/test/libsolidity/syntaxTests/parsing/library_simple.sol b/test/libsolidity/syntaxTests/parsing/library_simple.sol
index fcf2638e..006ff307 100644
--- a/test/libsolidity/syntaxTests/parsing/library_simple.sol
+++ b/test/libsolidity/syntaxTests/parsing/library_simple.sol
@@ -1,6 +1,5 @@
library Lib {
- function f() { }
+ function f() public { }
}
// ----
-// Warning: (18-34): No visibility specified. Defaulting to "public".
-// Warning: (18-34): Function state mutability can be restricted to pure
+// Warning: (18-41): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol
index 452b52c7..64116b88 100644
--- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol
+++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations.sol
@@ -1,5 +1,5 @@
contract c {
- function f()
+ function f() public
{
a = 1 wei;
b = 2 szabo;
@@ -12,5 +12,4 @@ contract c {
uint256 d;
}
// ----
-// Warning: (163-172): This declaration shadows an existing declaration.
-// Warning: (17-128): No visibility specified. Defaulting to "public".
+// Warning: (170-179): This declaration shadows an existing declaration.
diff --git a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol
index e0f49fbf..2f2302ed 100644
--- a/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol
+++ b/test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol
@@ -1,9 +1,7 @@
contract c {
- constructor()
+ constructor() public
{
a = 1 wei * 100 wei + 7 szabo - 3;
}
uint256 a;
}
-// ----
-// Warning: (17-86): No visibility specified. Defaulting to "public".
diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol
index 5d6c8dc5..e311dd96 100644
--- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol
+++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol
@@ -1,12 +1,11 @@
contract Foo {
- function f() {
+ function f() public {
uint[] storage x;
uint[] memory y;
}
}
// ----
-// Warning: (42-58): Uninitialized storage pointer.
-// Warning: (19-90): No visibility specified. Defaulting to "public".
-// Warning: (42-58): Unused local variable.
-// Warning: (68-83): Unused local variable.
-// Warning: (19-90): Function state mutability can be restricted to pure
+// Warning: (49-65): Uninitialized storage pointer.
+// Warning: (49-65): Unused local variable.
+// Warning: (75-90): Unused local variable.
+// Warning: (19-97): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol b/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol
index cb2f2985..cf986efe 100644
--- a/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol
+++ b/test/libsolidity/syntaxTests/parsing/modifier_invocation.sol
@@ -1,8 +1,7 @@
contract c {
modifier mod1(uint a) { if (msg.sender == address(a)) _; }
modifier mod2 { if (msg.sender == address(2)) _; }
- function f() mod1(7) mod2 { }
+ function f() public mod1(7) mod2 { }
}
// ----
-// Warning: (135-164): No visibility specified. Defaulting to "public".
-// Warning: (135-164): Function state mutability can be restricted to view
+// Warning: (135-171): Function state mutability can be restricted to view
diff --git a/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol b/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol
index 95a4d1e7..85d9e6a8 100644
--- a/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol
+++ b/test/libsolidity/syntaxTests/parsing/multiple_functions_natspec_documentation.sol
@@ -1,28 +1,24 @@
contract test {
uint256 stateVar;
/// This is test function 1
- function functionName1(bytes32 input) returns (bytes32 out) {}
+ function functionName1(bytes32 input) public returns (bytes32 out) {}
/// This is test function 2
- function functionName2(bytes32 input) returns (bytes32 out) {}
+ function functionName2(bytes32 input) public returns (bytes32 out) {}
// nothing to see here
- function functionName3(bytes32 input) returns (bytes32 out) {}
+ function functionName3(bytes32 input) public returns (bytes32 out) {}
/// This is test function 4
- function functionName4(bytes32 input) returns (bytes32 out) {}
+ function functionName4(bytes32 input) public returns (bytes32 out) {}
}
// ----
-// Warning: (74-136): No visibility specified. Defaulting to "public".
// Warning: (97-110): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (121-132): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (173-235): No visibility specified. Defaulting to "public".
-// Warning: (196-209): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (220-231): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (267-329): No visibility specified. Defaulting to "public".
-// Warning: (290-303): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (314-325): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (366-428): No visibility specified. Defaulting to "public".
-// Warning: (389-402): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (413-424): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (74-136): Function state mutability can be restricted to pure
-// Warning: (173-235): Function state mutability can be restricted to pure
-// Warning: (267-329): Function state mutability can be restricted to pure
-// Warning: (366-428): Function state mutability can be restricted to pure
+// Warning: (128-139): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (203-216): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (234-245): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (304-317): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (335-346): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (410-423): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (441-452): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (74-143): Function state mutability can be restricted to pure
+// Warning: (180-249): Function state mutability can be restricted to pure
+// Warning: (281-350): Function state mutability can be restricted to pure
+// Warning: (387-456): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/no_function_params.sol b/test/libsolidity/syntaxTests/parsing/no_function_params.sol
index 020f1233..5a024bdb 100644
--- a/test/libsolidity/syntaxTests/parsing/no_function_params.sol
+++ b/test/libsolidity/syntaxTests/parsing/no_function_params.sol
@@ -1,7 +1,6 @@
contract test {
uint256 stateVar;
- function functionName() {}
+ function functionName() public {}
}
// ----
-// Warning: (36-62): No visibility specified. Defaulting to "public".
-// Warning: (36-62): Function state mutability can be restricted to pure
+// Warning: (36-69): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol b/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol
index 1a78d155..fe050d1b 100644
--- a/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol
+++ b/test/libsolidity/syntaxTests/parsing/overloaded_functions.sol
@@ -1,9 +1,7 @@
contract test {
- function fun(uint a) returns(uint r) { return a; }
- function fun(uint a, uint b) returns(uint r) { return a + b; }
+ function fun(uint a) public returns(uint r) { return a; }
+ function fun(uint a, uint b) public returns(uint r) { return a + b; }
}
// ----
-// Warning: (17-67): No visibility specified. Defaulting to "public".
-// Warning: (69-131): No visibility specified. Defaulting to "public".
-// Warning: (17-67): Function state mutability can be restricted to pure
-// Warning: (69-131): Function state mutability can be restricted to pure
+// Warning: (17-74): Function state mutability can be restricted to pure
+// Warning: (76-145): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol
index e331440d..a50855c0 100644
--- a/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol
+++ b/test/libsolidity/syntaxTests/parsing/placeholder_in_function_context.sol
@@ -1,9 +1,8 @@
contract c {
- function fun() returns (uint r) {
+ function fun() public returns (uint r) {
uint _ = 8;
return _ + 1;
}
}
// ----
-// Warning: (17-98): No visibility specified. Defaulting to "public".
-// Warning: (17-98): Function state mutability can be restricted to pure
+// Warning: (17-105): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/single_function_param.sol b/test/libsolidity/syntaxTests/parsing/single_function_param.sol
index 08e531f1..955f20f0 100644
--- a/test/libsolidity/syntaxTests/parsing/single_function_param.sol
+++ b/test/libsolidity/syntaxTests/parsing/single_function_param.sol
@@ -1,9 +1,8 @@
contract test {
uint256 stateVar;
- function functionName(bytes32 input) returns (bytes32 out) {}
+ function functionName(bytes32 input) public returns (bytes32 out) {}
}
// ----
-// Warning: (36-97): No visibility specified. Defaulting to "public".
// Warning: (58-71): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (82-93): Unused function parameter. Remove or comment out the variable name to silence this warning.
-// Warning: (36-97): Function state mutability can be restricted to pure
+// Warning: (89-100): Unused function parameter. Remove or comment out the variable name to silence this warning.
+// Warning: (36-104): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/tuples.sol b/test/libsolidity/syntaxTests/parsing/tuples.sol
index d691da44..8266c94f 100644
--- a/test/libsolidity/syntaxTests/parsing/tuples.sol
+++ b/test/libsolidity/syntaxTests/parsing/tuples.sol
@@ -1,5 +1,5 @@
contract C {
- function f() {
+ function f() public {
uint a = (1);
(uint b,) = (1,);
(uint c, uint d) = (1, 2 + a);
@@ -8,10 +8,9 @@ contract C {
}
}
// ----
-// Warning: (47-63): Different number of components on the left hand side (2) than on the right hand side (1).
-// Warning: (100-121): Different number of components on the left hand side (2) than on the right hand side (3).
-// Warning: (14-136): No visibility specified. Defaulting to "public".
-// Warning: (68-74): Unused local variable.
-// Warning: (76-82): Unused local variable.
-// Warning: (101-107): Unused local variable.
-// Warning: (14-136): Function state mutability can be restricted to pure
+// Warning: (54-70): Different number of components on the left hand side (2) than on the right hand side (1).
+// Warning: (107-128): Different number of components on the left hand side (2) than on the right hand side (3).
+// Warning: (75-81): Unused local variable.
+// Warning: (83-89): Unused local variable.
+// Warning: (108-114): Unused local variable.
+// Warning: (14-143): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol b/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol
index 4706a26d..db890b37 100644
--- a/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol
+++ b/test/libsolidity/syntaxTests/parsing/visibility_specifiers.sol
@@ -3,15 +3,12 @@ contract c {
uint internal b;
uint public c;
uint d;
- function f() {}
+ function f() public {}
function f_priv() private {}
- function f_public() public {}
function f_internal() internal {}
}
// ----
// Warning: (58-71): This declaration shadows an existing declaration.
-// Warning: (89-104): No visibility specified. Defaulting to "public".
-// Warning: (89-104): Function state mutability can be restricted to pure
-// Warning: (109-137): Function state mutability can be restricted to pure
-// Warning: (142-171): Function state mutability can be restricted to pure
-// Warning: (176-209): Function state mutability can be restricted to pure
+// Warning: (89-111): Function state mutability can be restricted to pure
+// Warning: (116-144): Function state mutability can be restricted to pure
+// Warning: (149-182): Function state mutability can be restricted to pure
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/566_require_visibility_specifiers.sol b/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol
index 7330ef8d..7330ef8d 100644
--- a/test/libsolidity/syntaxTests/nameAndTypeResolution/566_require_visibility_specifiers.sol
+++ b/test/libsolidity/syntaxTests/visibility/function_no_visibility.sol
diff --git a/test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol b/test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol
new file mode 100644
index 00000000..ec7c0937
--- /dev/null
+++ b/test/libsolidity/syntaxTests/visibility/function_no_visibility_050.sol
@@ -0,0 +1,6 @@
+pragma experimental "v0.5.0";
+contract C {
+ function f() pure { }
+}
+// ----
+// SyntaxError: (47-68): No visibility specified.