From 46d6454b1f47e53c791d71aba26bb953ec667433 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 3 Jul 2018 15:10:39 +0200 Subject: Update tests. --- .../syntaxTests/array/uninitialized_storage_var.sol | 9 +++++++++ .../206_storage_location_local_variables.sol | 10 ++++------ .../211_uninitialized_mapping_array_variable.sol | 2 +- .../212_uninitialized_mapping_array_variable_050.sol | 9 --------- .../nameAndTypeResolution/233_non_initialized_references.sol | 2 +- .../234_non_initialized_references_050.sol | 11 ----------- .../libsolidity/syntaxTests/parsing/arrays_in_expressions.sol | 2 +- .../syntaxTests/parsing/location_specifiers_for_locals.sol | 10 ++++------ 8 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol delete mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/212_uninitialized_mapping_array_variable_050.sol delete mode 100644 test/libsolidity/syntaxTests/nameAndTypeResolution/234_non_initialized_references_050.sol (limited to 'test/libsolidity/syntaxTests') diff --git a/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol b/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol new file mode 100644 index 00000000..363d8147 --- /dev/null +++ b/test/libsolidity/syntaxTests/array/uninitialized_storage_var.sol @@ -0,0 +1,9 @@ +contract C { + function f() { + uint[] storage x; + uint[10] storage y; + } +} +// ---- +// DeclarationError: (31-47): Uninitialized storage pointer. +// DeclarationError: (51-69): Uninitialized storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/206_storage_location_local_variables.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/206_storage_location_local_variables.sol index 5199e5d7..868d7bc8 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/206_storage_location_local_variables.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/206_storage_location_local_variables.sol @@ -1,11 +1,9 @@ contract C { - function f() public { - uint[] storage x; + uint[] m_x; + function f() public view { + uint[] storage x = m_x; uint[] memory y; - uint[] memory z; - x;y;z; + x;y; } } // ---- -// Warning: (47-63): Uninitialized storage pointer. -// Warning: (17-135): Function state mutability can be restricted to pure diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol index 80467491..edae7549 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/211_uninitialized_mapping_array_variable.sol @@ -5,4 +5,4 @@ contract C { } } // ---- -// Warning: (52-85): Uninitialized storage pointer. +// DeclarationError: (52-85): Uninitialized storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/212_uninitialized_mapping_array_variable_050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/212_uninitialized_mapping_array_variable_050.sol deleted file mode 100644 index f2028690..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/212_uninitialized_mapping_array_variable_050.sol +++ /dev/null @@ -1,9 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - function f() pure public { - mapping(uint => uint)[] storage x; - x; - } -} -// ---- -// DeclarationError: (82-115): Uninitialized storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol index 9d8d4834..a0b6f71e 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/233_non_initialized_references.sol @@ -8,4 +8,4 @@ contract C { } } // ---- -// Warning: (84-95): Uninitialized storage pointer. +// DeclarationError: (84-95): Uninitialized storage pointer. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/234_non_initialized_references_050.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/234_non_initialized_references_050.sol deleted file mode 100644 index c221b73c..00000000 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/234_non_initialized_references_050.sol +++ /dev/null @@ -1,11 +0,0 @@ -pragma experimental "v0.5.0"; -contract C { - struct s { - uint a; - } - function f() public { - s storage x; - } -} -// ---- -// DeclarationError: (114-125): Uninitialized storage pointer. diff --git a/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol b/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol index 95ef66d4..2b35ffda 100644 --- a/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol +++ b/test/libsolidity/syntaxTests/parsing/arrays_in_expressions.sol @@ -5,4 +5,4 @@ contract c { // Warning: (39-46): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning. // Warning: (52-67): Variable is declared as a storage pointer. Use an explicit "storage" keyword to silence this warning. // TypeError: (39-50): Type int_const 7 is not implicitly convertible to expected type contract c[10] storage pointer. -// Warning: (52-67): Uninitialized storage pointer. Did you mean ' memory x'? +// DeclarationError: (52-67): Uninitialized storage pointer. Did you mean ' memory x'? diff --git a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol index e311dd96..38de7b1c 100644 --- a/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol +++ b/test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol @@ -1,11 +1,9 @@ contract Foo { - function f() public { - uint[] storage x; + uint[] m_x; + function f() public view { + uint[] storage x = m_x; uint[] memory y; + x; y; } } // ---- -// 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 -- cgit