Skip to content

Commit e745fea

Browse files
Add and update tests
1 parent 721bb93 commit e745fea

File tree

71 files changed

+1387
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1387
-45
lines changed

Diff for: libsolidity/interface/CompilerStack.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,6 @@ Json const& CompilerStack::storageLayout(Contract const& _contract) const
11141114
solAssert(m_stackState >= AnalysisSuccessful, "Analysis was not successful.");
11151115
solAssert(_contract.contract);
11161116
solUnimplementedAssert(!isExperimentalSolidity());
1117-
solUnimplementedAssert(!_contract.contract->storageLayoutSpecifier(), "Storage layout not supported for contract with specified layout base.");
11181117

11191118
return _contract.storageLayout.init([&]{ return StorageLayout().generate(*_contract.contract, DataLocation::Storage); });
11201119
}
@@ -1539,7 +1538,6 @@ void CompilerStack::compileContract(
15391538
solAssert(!m_viaIR, "");
15401539
solUnimplementedAssert(!m_eofVersion.has_value(), "Experimental EOF support is only available for via-IR compilation.");
15411540
solAssert(m_stackState >= AnalysisSuccessful, "");
1542-
solUnimplementedAssert(!_contract.storageLayoutSpecifier(), "Code generation is not supported for contracts with specified storage layout base.");
15431541

15441542
if (_otherCompilers.count(&_contract))
15451543
return;
@@ -1575,7 +1573,6 @@ void CompilerStack::compileContract(
15751573
void CompilerStack::generateIR(ContractDefinition const& _contract, bool _unoptimizedOnly)
15761574
{
15771575
solAssert(m_stackState >= AnalysisSuccessful, "");
1578-
solUnimplementedAssert(!_contract.storageLayoutSpecifier(), "Code generation is not supported for contracts with specified storage layout base.");
15791576
Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
15801577
if (compiledContract.yulIR)
15811578
{

Diff for: test/cmdlineTests/storage_layout_specifier_codegen_error/args

-1
This file was deleted.

Diff for: test/cmdlineTests/storage_layout_specifier_codegen_error/err

-5
This file was deleted.

Diff for: test/cmdlineTests/storage_layout_specifier_codegen_error/exit

-1
This file was deleted.

Diff for: test/cmdlineTests/storage_layout_specifier_codegen_error/stdin

-4
This file was deleted.

Diff for: test/cmdlineTests/storage_layout_specifier_ir_codegen_error/args

-1
This file was deleted.

Diff for: test/cmdlineTests/storage_layout_specifier_ir_codegen_error/err

-5
This file was deleted.

Diff for: test/cmdlineTests/storage_layout_specifier_ir_codegen_error/exit

-1
This file was deleted.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--no-cbor-metadata --optimize --asm --debug-info none -
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
======= <stdin>:C =======
3+
EVM assembly:
4+
mstore(0x40, 0x80)
5+
callvalue
6+
dup1
7+
iszero
8+
tag_1
9+
jumpi
10+
revert(0x00, 0x00)
11+
tag_1:
12+
pop
13+
dataSize(sub_0)
14+
dup1
15+
dataOffset(sub_0)
16+
0x00
17+
codecopy
18+
0x00
19+
return
20+
stop
21+
22+
sub_0: assembly {
23+
mstore(0x40, 0x80)
24+
callvalue
25+
dup1
26+
iszero
27+
tag_1
28+
jumpi
29+
revert(0x00, 0x00)
30+
tag_1:
31+
pop
32+
jumpi(tag_2, lt(calldatasize, 0x04))
33+
shr(0xe0, calldataload(0x00))
34+
dup1
35+
0x26121ff0
36+
eq
37+
tag_3
38+
jumpi
39+
tag_2:
40+
revert(0x00, 0x00)
41+
tag_3:
42+
tag_4
43+
tag_5
44+
jump // in
45+
tag_4:
46+
stop
47+
tag_5:
48+
sload(0x0abc)
49+
tag_7
50+
swap1
51+
0x01
52+
tag_8
53+
jump // in
54+
tag_7:
55+
0x0abc
56+
sstore
57+
jump // out
58+
tag_8:
59+
dup1
60+
dup3
61+
add
62+
dup1
63+
dup3
64+
gt
65+
iszero
66+
tag_11
67+
jumpi
68+
0x4e487b71
69+
0xe0
70+
shl
71+
0x00
72+
mstore
73+
0x11
74+
0x04
75+
mstore
76+
0x24
77+
0x00
78+
revert
79+
tag_11:
80+
swap3
81+
swap2
82+
pop
83+
pop
84+
jump // out
85+
}
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// SPDX-License-Identifier: GPL-3.0
2+
pragma solidity >=0.0.0;
3+
4+
contract C layout at 0xABC {
5+
uint x;
6+
function f() public {
7+
x = x + 1;
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--optimize --ir-optimized --debug-info none -
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Optimized IR:
2+
/// @use-src 0:"<stdin>"
3+
object "C_7" {
4+
code {
5+
{
6+
let _1 := memoryguard(0x80)
7+
mstore(64, _1)
8+
if callvalue() { revert(0, 0) }
9+
sstore(0x2a, 0x0a)
10+
let _2 := datasize("C_7_deployed")
11+
codecopy(_1, dataoffset("C_7_deployed"), _2)
12+
return(_1, _2)
13+
}
14+
}
15+
/// @use-src 0:"<stdin>"
16+
object "C_7_deployed" {
17+
code { { revert(0, 0) } }
18+
data ".metadata" hex"<BYTECODE REMOVED>"
19+
}
20+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
//SPDX-License-Identifier: GPL-3.0
22
pragma solidity >=0.0;
33

4-
contract C layout at 42 {}
4+
contract C layout at 42 {
5+
uint x = 10;
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--storage-layout --transient-storage-layout --pretty-json --json-indent 4 -

0 commit comments

Comments
 (0)