Remove linking to unqualified library name

- SemanticTests accepts fully qualified library name and also unqualifed library name when
the library is defined in the same file for convenience.
- commandline tests are added!

Signed-off-by: soroosh-sdi <soroosh.sardari@gmail.com>
This commit is contained in:
soroosh-sdi
2021-10-20 18:11:58 +03:30
parent 1e630fc584
commit 816d8021e4
33 changed files with 242 additions and 64 deletions
@@ -0,0 +1 @@
linking_qualified_library_name/contract1.sol --bin --libraries linking_qualified_library_name/math.sol:Log:0x7777777777777777777777777777777777777777
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
import "linking_qualified_library_name/math.sol";
contract C {
function foo() public {
Log.log10();
}
}
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
library Log {
function log10() external {}
}
@@ -0,0 +1,8 @@
======= linking_qualified_library_name/contract1.sol:C =======
Binary:
<BYTECODE REMOVED>
======= linking_qualified_library_name/math.sol:Log =======
Binary:
<BYTECODE REMOVED>
@@ -1,26 +0,0 @@
======= linking_strict_assembly_no_file_name_in_link_reference/input.yul (EVM) =======
Pretty printed source:
object "a" {
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}
Binary representation:
7312345678901234567890123456789012345678908060005550
Text representation:
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":44:61 */
linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8")
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":80:84 */
dup1
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":77:78 */
0x00
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":70:85 */
sstore
/* "linking_strict_assembly_no_file_name_in_link_reference/input.yul":22:91 */
pop
@@ -0,0 +1 @@
--strict-assembly --libraries :L=0x1234567890123456789012345678901234567890 --debug-info none
@@ -0,0 +1,6 @@
object "a" {
code {
let addr := linkersymbol(":L")
sstore(0, addr)
}
}
@@ -0,0 +1,21 @@
======= linking_strict_assembly_qualified_library_qualified_reference/input.yul (EVM) =======
Pretty printed source:
object "a" {
code {
let addr := linkersymbol(":L")
sstore(0, addr)
}
}
Binary representation:
7312345678901234567890123456789012345678908060005550
Text representation:
linkerSymbol("20a18a9bf97d889dcf77111b674da319a4e9e3e05d3f4df9e0bf5c588dd4f0f8")
dup1
0x00
sstore
pop
@@ -0,0 +1 @@
--strict-assembly --libraries :L=0x1234567890123456789012345678901234567890 --debug-info none
@@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.
@@ -0,0 +1,21 @@
======= linking_strict_assembly_qualified_library_unqualified_reference/input.yul (EVM) =======
Pretty printed source:
object "a" {
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}
Binary representation:
73__$8aa64f937099b65a4febc243a5ae0f2d64$__8060005550
Text representation:
linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8")
dup1
0x00
sstore
pop
@@ -1 +1 @@
--strict-assembly --libraries L=0x1234567890123456789012345678901234567890
--strict-assembly --libraries L=0x1234567890123456789012345678901234567890 --debug-info none
@@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.
@@ -0,0 +1,6 @@
object "a" {
code {
let addr := linkersymbol(":L")
sstore(0, addr)
}
}
@@ -0,0 +1,21 @@
======= linking_strict_assembly_unqualified_library_qualified_reference/input.yul (EVM) =======
Pretty printed source:
object "a" {
code {
let addr := linkersymbol(":L")
sstore(0, addr)
}
}
Binary representation:
73__$20a18a9bf97d889dcf77111b674da319a4$__8060005550
Text representation:
linkerSymbol("20a18a9bf97d889dcf77111b674da319a4e9e3e05d3f4df9e0bf5c588dd4f0f8")
dup1
0x00
sstore
pop
@@ -0,0 +1 @@
--strict-assembly --libraries L=0x1234567890123456789012345678901234567890 --debug-info none
@@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.
@@ -0,0 +1,6 @@
object "a" {
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}
@@ -0,0 +1,21 @@
======= linking_strict_assembly_unqualified_library_unqualified_reference/input.yul (EVM) =======
Pretty printed source:
object "a" {
code {
let addr := linkersymbol("L")
sstore(0, addr)
}
}
Binary representation:
7312345678901234567890123456789012345678908060005550
Text representation:
linkerSymbol("8aa64f937099b65a4febc243a5ae0f2d6416bb9e473c30dd29c1ee498fb7c5a8")
dup1
0x00
sstore
pop
@@ -0,0 +1 @@
linking_unqualified_library_name/contract1.sol linking_unqualified_library_name/contract2.sol --bin --libraries Log:0x7777777777777777777777777777777777777777
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
import "linking_unqualified_library_name/error.sol";
contract C {
function foo() public {
Log.print();
}
}
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
import "linking_unqualified_library_name/math.sol";
contract C {
function foo() public {
Log.log10();
}
}
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
library Log {
function print() external {}
}
@@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.0;
library Log {
function log10() external {}
}
@@ -0,0 +1,20 @@
======= linking_unqualified_library_name/contract1.sol:C =======
Binary:
<BYTECODE REMOVED>__$cdf6d5ab08a9335b02e7c2475aa27d04fa$__<BYTECODE REMOVED>
// $cdf6d5ab08a9335b02e7c2475aa27d04fa$ -> linking_unqualified_library_name/error.sol:Log
======= linking_unqualified_library_name/contract2.sol:C =======
Binary:
<BYTECODE REMOVED>__$22584241c2fc4f2884d5222245463779a8$__<BYTECODE REMOVED>
// $22584241c2fc4f2884d5222245463779a8$ -> linking_unqualified_library_name/math.sol:Log
======= linking_unqualified_library_name/error.sol:Log =======
Binary:
<BYTECODE REMOVED>
======= linking_unqualified_library_name/math.sol:Log =======
Binary:
<BYTECODE REMOVED>