-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efdaaf0
commit 306fd77
Showing
23 changed files
with
204 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
test/libsolidity/syntaxTests/inline_arrays/unnamed_types_in_inline_array_3.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
contract C { | ||
function f() public pure { | ||
[uint]; | ||
} | ||
} | ||
// ---- | ||
// TypeError 9563: (53-57): Invalid mobile type. |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/syntaxTests/metaTypes/array_type_from_ternary.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
function f(bool c) public { | ||
(c ? uint[2] : uint[2])[3]; | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (58-65): Invalid mobile type in true expression. | ||
// TypeError 3703: (68-75): Invalid mobile type in false expression. |
9 changes: 9 additions & 0 deletions
9
test/libsolidity/syntaxTests/metaTypes/contract_from_ternary.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
contract C { | ||
function f() public pure { } | ||
function g(bool c) public { | ||
(c ? C : C).f(); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (91-92): Invalid mobile type in true expression. | ||
// TypeError 3703: (95-96): Invalid mobile type in false expression. |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/syntaxTests/metaTypes/explicit_type_conversion.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
function f(bool c) pure public returns (int) { | ||
return (c ? int : int)(0); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (84-87): Invalid mobile type in true expression. | ||
// TypeError 3703: (90-93): Invalid mobile type in false expression. |
12 changes: 12 additions & 0 deletions
12
test/libsolidity/syntaxTests/metaTypes/library_from_ternary.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
library L { | ||
function f() public pure { } | ||
} | ||
|
||
contract C { | ||
function g(bool c) public { | ||
(c ? L : L).f(); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (106-107): Invalid mobile type in true expression. | ||
// TypeError 3703: (110-111): Invalid mobile type in false expression. |
14 changes: 14 additions & 0 deletions
14
test/libsolidity/syntaxTests/metaTypes/struct_from_ternary.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
struct S { | ||
uint x; | ||
uint y; | ||
uint z; | ||
} | ||
|
||
contract C { | ||
function f(bool c) public pure { | ||
S memory s = (c ? S : S)(0, 1, 2); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (126-127): Invalid mobile type in true expression. | ||
// TypeError 3703: (130-131): Invalid mobile type in false expression. |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/syntaxTests/metaTypes/type_expression_nested_ternary_max_keyword.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
function f(bool b) public pure returns (uint) { | ||
return type(b ? uint : uint).max; | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (89-93): Invalid mobile type in true expression. | ||
// TypeError 3703: (96-100): Invalid mobile type in false expression. |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/syntaxTests/metaTypes/type_from_ternary_condition.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
function f(bool c) pure public { | ||
type(c ? uint : uint); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (67-71): Invalid mobile type in true expression. | ||
// TypeError 3703: (74-78): Invalid mobile type in false expression. |
17 changes: 17 additions & 0 deletions
17
...libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_array_of_unitary_tuples.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", ((uint)[2])); | ||
abi.decode("", ((uint)[])); | ||
abi.decode("", ((uint)[][3])); | ||
abi.decode("", ((uint)[4][])); | ||
abi.decode("", ((uint)[5][6])); | ||
abi.decode("", (((uint))[5][6])); | ||
} | ||
} | ||
// ---- | ||
// Warning 6133: (52-79): Statement has no effect. | ||
// Warning 6133: (89-115): Statement has no effect. | ||
// Warning 6133: (125-154): Statement has no effect. | ||
// Warning 6133: (164-193): Statement has no effect. | ||
// Warning 6133: (203-233): Statement has no effect. | ||
// Warning 6133: (243-275): Statement has no effect. |
8 changes: 8 additions & 0 deletions
8
test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_enum.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
enum Color { red, green, blue } | ||
function f() pure public { | ||
abi.decode("", (Color)); | ||
} | ||
} | ||
// ---- | ||
// Warning 6133: (88-111): Statement has no effect. |
9 changes: 9 additions & 0 deletions
9
...Functions/abidecode/abi_decode_invalid_argument_array_length_ternary_with_max_keyword.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
contract C { | ||
function f() pure public { | ||
bool x; | ||
abi.decode("", (uint[type(x = true ? uint8 : uint8).max])); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (105-110): Invalid mobile type in true expression. | ||
// TypeError 3703: (113-118): Invalid mobile type in false expression. |
7 changes: 7 additions & 0 deletions
7
...ty/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_array_of_tuples.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", ((uint, int)[5][6])); | ||
} | ||
} | ||
// ---- | ||
// TypeError 2614: (68-79): Indexed expression has to be a type, mapping or array (is tuple(type(uint256),type(int256))) |
7 changes: 7 additions & 0 deletions
7
...taxTests/specialFunctions/abidecode/abi_decode_invalid_argument_indexed_array_literal.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", ([uint][2])); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9563: (69-73): Invalid mobile type. |
9 changes: 9 additions & 0 deletions
9
...sts/specialFunctions/abidecode/abi_decode_invalid_argument_indexed_ternary_expression.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
contract C { | ||
function f() pure public { | ||
bool x; | ||
abi.decode("", ((x = true ? uint : uint)[0])); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (96-100): Invalid mobile type in true expression. | ||
// TypeError 3703: (103-107): Invalid mobile type in false expression. |
8 changes: 8 additions & 0 deletions
8
...s/specialFunctions/abidecode/abi_decode_invalid_argument_ternary_condition_expression.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", (true ? uint : uint)); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (75-79): Invalid mobile type in true expression. | ||
// TypeError 3703: (82-86): Invalid mobile type in false expression. |
8 changes: 8 additions & 0 deletions
8
...Functions/abidecode/abi_decode_invalid_argument_ternary_expression_inside_parentheses.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", ((true ? uint : uint))); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (76-80): Invalid mobile type in true expression. | ||
// TypeError 3703: (83-87): Invalid mobile type in false expression. |
9 changes: 9 additions & 0 deletions
9
...Tests/specialFunctions/abidecode/abi_decode_invalid_argument_ternary_with_side_effect.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
contract C { | ||
function f() pure public { | ||
int x; | ||
abi.decode("", ((x = 1) > 0 ? int : int)); | ||
} | ||
} | ||
// ---- | ||
// TypeError 9717: (97-100): Invalid mobile type in true expression. | ||
// TypeError 3703: (103-106): Invalid mobile type in false expression. |
7 changes: 7 additions & 0 deletions
7
...olidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_tuple_type.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", ((uint, int))); | ||
} | ||
} | ||
// ---- | ||
// TypeError 1039: (68-79): Argument has to be a type name. |
7 changes: 7 additions & 0 deletions
7
...ty/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_argument_type_expression.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
contract C { | ||
function f() pure public { | ||
abi.decode("", (type(uint))); | ||
} | ||
} | ||
// ---- | ||
// TypeError 1039: (68-78): Argument has to be a type name. |
19 changes: 19 additions & 0 deletions
19
test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_member_acess.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
library L { | ||
struct S { int a; } | ||
enum State { idle, running, blocked } | ||
} | ||
|
||
contract D { | ||
struct X { uint b; } | ||
enum Color { red, green, blue } | ||
} | ||
|
||
contract C { | ||
function f() pure public { | ||
abi.decode("", (L.S)); | ||
abi.decode("", (L.State)); | ||
abi.decode("", (D.X)); | ||
abi.decode("", (D.Color)); | ||
} | ||
} | ||
// ---- |
13 changes: 13 additions & 0 deletions
13
test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_unitary_nested_tuple.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
struct S { int a; } | ||
|
||
contract C { | ||
function f() pure public { | ||
abi.decode("", (((uint)))); | ||
abi.decode("", ((((uint))))); | ||
abi.decode("", (((S)))); | ||
} | ||
} | ||
// ---- | ||
// Warning 6133: (73-99): Statement has no effect. | ||
// Warning 6133: (109-137): Statement has no effect. | ||
// Warning 6133: (147-170): Statement has no effect. |