-
Notifications
You must be signed in to change notification settings - Fork 6k
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
33f72b5
commit a3e17ed
Showing
20 changed files
with
151 additions
and
8 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
test/cmdlineTests/storage_base_location_defined_ancestor/in.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,10 @@ | ||
//SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity >=0.0; | ||
contract A layout at 0x1234 { | ||
} | ||
|
||
contract B is A { | ||
} | ||
|
||
contract C layout at 0x1234 is B { | ||
} |
11 changes: 11 additions & 0 deletions
11
test/cmdlineTests/storage_base_location_defined_ancestor/input.json
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,11 @@ | ||
{ | ||
"language": "Solidity", | ||
"sources": { | ||
"fileA": {"urls": ["storage_base_location_defined_ancestor/in.sol"]} | ||
}, | ||
"settings": { | ||
"outputSelection": { | ||
"fileA": { "A": ["*"] } | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
test/cmdlineTests/storage_base_location_defined_ancestor/output.json
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,69 @@ | ||
{ | ||
"errors": [ | ||
{ | ||
"component": "general", | ||
"errorCode": "8894", | ||
"formattedMessage": "TypeError: Storage base location can only be specified in the most derived contract. | ||
--> fileA:6:1: | ||
| | ||
6 | contract B is A { | ||
| ^ (Relevant source part starts here and spans across multiple lines). | ||
Note: Storage base location was already specified here. | ||
--> fileA:3:12: | ||
| | ||
3 | contract A layout at 0x1234 { | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
", | ||
"message": "Storage base location can only be specified in the most derived contract.", | ||
"secondarySourceLocations": [ | ||
{ | ||
"end": 85, | ||
"file": "fileA", | ||
"message": "Storage base location was already specified here.", | ||
"start": 69 | ||
} | ||
], | ||
"severity": "error", | ||
"sourceLocation": { | ||
"end": 110, | ||
"file": "fileA", | ||
"start": 91 | ||
}, | ||
"type": "TypeError" | ||
}, | ||
{ | ||
"component": "general", | ||
"errorCode": "8894", | ||
"formattedMessage": "TypeError: Storage base location can only be specified in the most derived contract. | ||
--> fileA:9:1: | ||
| | ||
9 | contract C layout at 0x1234 is B { | ||
| ^ (Relevant source part starts here and spans across multiple lines). | ||
Note: Storage base location was already specified here. | ||
--> fileA:3:12: | ||
| | ||
3 | contract A layout at 0x1234 { | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
", | ||
"message": "Storage base location can only be specified in the most derived contract.", | ||
"secondarySourceLocations": [ | ||
{ | ||
"end": 85, | ||
"file": "fileA", | ||
"message": "Storage base location was already specified here.", | ||
"start": 69 | ||
} | ||
], | ||
"severity": "error", | ||
"sourceLocation": { | ||
"end": 148, | ||
"file": "fileA", | ||
"start": 112 | ||
}, | ||
"type": "TypeError" | ||
} | ||
], | ||
"sources": {} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/abstract_contract.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,4 @@ | ||
abstract contract C layout at 0x123 { | ||
} | ||
// ---- | ||
// TypeError 7587: (20-35): Storage layout cannot be specified for abstract contracts or libraries |
8 changes: 8 additions & 0 deletions
8
...ity/syntaxTests/storageLayoutSpecifier/layout_already_specified_in_ancestor_contract_.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 A layout at 0x1234 {} | ||
|
||
contract B is A {} | ||
|
||
contract C is B layout at 0xABCD {} | ||
// ---- | ||
// TypeError 8894: (32-50): Storage layout can only be specified in the most derived contract. | ||
// TypeError 8894: (52-87): Storage layout can only be specified in the most derived contract. |
3 changes: 3 additions & 0 deletions
3
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_bitwise_negation_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,3 @@ | ||
contract C layout at ~0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE {} | ||
// ---- | ||
// TypeError 1763: (21-88): Storage layout cannot be specified by a number exceeding the range of type uint256. Current type is int_const -115...(71 digits omitted)...9935 Cannot implicitly convert signed literal to unsigned type. |
3 changes: 3 additions & 0 deletions
3
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_fractional_number.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,3 @@ | ||
contract A layout at 3/2 {} | ||
// ---- | ||
// TypeError 1763: (21-24): Storage layout cannot be specified by a fractional number. |
8 changes: 8 additions & 0 deletions
8
...syntaxTests/storageLayoutSpecifier/layout_not_specified_in_most_derived_contract_copy.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 A layout at 0x1234 {} | ||
|
||
contract B is A {} | ||
|
||
contract C is B {} | ||
// ---- | ||
// TypeError 8894: (32-50): Storage layout can only be specified in the most derived contract. | ||
// TypeError 8894: (52-70): Storage layout can only be specified in the most derived contract. |
2 changes: 0 additions & 2 deletions
2
...libsolidity/syntaxTests/storageLayoutSpecifier/layout_specification_binary_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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
contract C layout at 0xffff * (0x123 + 0xABC) { } | ||
// ==== | ||
// stopAfter: parsing | ||
// ---- |
4 changes: 4 additions & 0 deletions
4
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specification_bytes.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,4 @@ | ||
bytes32 constant b = "bytes"; | ||
contract A layout at b[1] {} | ||
// ---- | ||
// TypeError 1763: (51-55): Storage layout cannot be specified by a number exceeding the range of type uint256. Current type is bytes1 |
3 changes: 1 addition & 2 deletions
3
...lidity/syntaxTests/storageLayoutSpecifier/layout_specification_constant_in_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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
uint constant X = 42; | ||
contract C layout at 0xffff * (50 - X) { } | ||
// ==== | ||
// stopAfter: parsing | ||
// ---- | ||
// TypeError 6396: (43-60): The storage layout can only be specified by number literals. |
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
2 changes: 2 additions & 0 deletions
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specification_max_value.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,2 @@ | ||
contract C layout at 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF {} | ||
// ---- |
3 changes: 3 additions & 0 deletions
3
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specification_overflow_value.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,3 @@ | ||
contract C layout at 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + 1 {} | ||
// ---- | ||
// TypeError 1763: (21-91): Storage layout cannot be specified by a number exceeding the range of type uint256. Current type is int_const 1157...(70 digits omitted)...9936 Literal is too large to fit in uint256. |
3 changes: 3 additions & 0 deletions
3
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_specification_underflow_value.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,3 @@ | ||
contract A layout at 0 - 1 {} | ||
// ---- | ||
// TypeError 1763: (21-26): Storage layout cannot be specified by a number exceeding the range of type uint256. Current type is int_const -1 Cannot implicitly convert signed literal to unsigned type. |
5 changes: 5 additions & 0 deletions
5
...ibsolidity/syntaxTests/storageLayoutSpecifier/layout_specified_by_expression_not_pure.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,5 @@ | ||
function f(uint x) returns (uint) { return x + 1; } | ||
contract A layout at f(2) {} | ||
// ---- | ||
// TypeError 1139: (73-77): The storage layout must be specified by an expression that can be evaluated at compilation time. | ||
// TypeError 6396: (73-77): The storage layout can only be specified by number literals. |
5 changes: 4 additions & 1 deletion
5
test/libsolidity/syntaxTests/storageLayoutSpecifier/layout_with_inheritance.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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
contract A { } | ||
contract B { } | ||
contract Z { } | ||
contract C is A, B layout at 0x1234 { } | ||
contract D layout at 0xABCD is A, B { } | ||
contract D layout at 0xABCD is Z { } | ||
// ---- | ||
// TypeError 2031: (70-109): Conflicting storage layout specifications:Storage layout for base contract 'A' was also specified by another contract which derives from it. | ||
// TypeError 2031: (70-109): Conflicting storage layout specifications:Storage layout for base contract 'B' was also specified by another contract which derives from it. |
5 changes: 5 additions & 0 deletions
5
test/libsolidity/syntaxTests/storageLayoutSpecifier/library.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,5 @@ | ||
library L layout at 0x123 { | ||
function f() public pure { } | ||
} | ||
// ---- | ||
// TypeError 7587: (10-25): Storage layout cannot be specified for abstract contracts or libraries |
5 changes: 5 additions & 0 deletions
5
test/libsolidity/syntaxTests/storageLayoutSpecifier/same_ancestor_two_contracts.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,5 @@ | ||
contract A {} | ||
contract B is A layout at 64 {} | ||
contract C is A layout at 42 {} | ||
// ---- | ||
// TypeError 2031: (46-77): Conflicting storage layout specifications:Storage layout for base contract 'A' was also specified by another contract which derives from it. |
2 changes: 1 addition & 1 deletion
2
test/libsolidity/syntaxTests/storageLayoutSpecifier/simple_layout.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
contract A layout at 0x1234 {} | ||
contract B layout at 1024 {} | ||
contract C layout at "C" {} | ||
contract C layout at 0 {} | ||
// ---- |