Sol -> Yul Generation: Implicit conversions

This commit is contained in:
Mathias Baumann
2019-04-24 22:52:17 +02:00
committed by chriseth
parent 6292adbde6
commit 944ac6fb6d
5 changed files with 76 additions and 16 deletions
@@ -0,0 +1,14 @@
// Tests IRGeneratorForStatements::visit(Assignment const& _assignment)
contract C {
function f() public pure returns (uint16 x) {
uint8 y;
assembly {
y := 0x12345678
}
x = y;
}
}
// ====
// compileViaYul: true
// ----
// f() -> 0x78
@@ -0,0 +1,17 @@
// IRGeneratorForStatements::visit(FunctionCall const& _functionCall)
contract C {
function f(uint b) public pure returns (uint x) {
x = b;
}
function g() public pure returns (uint x) {
uint8 a;
assembly {
a := 0x12345678
}
x = f(a);
}
}
// ====
// compileViaYul: true
// ----
// g() -> 0x78
@@ -0,0 +1,13 @@
// IRGeneratorForStatements::visit(VariableDeclarationStatement const& _varDeclStatement)
contract C {
function f() public pure returns (uint y) {
uint8 a;
assembly { a := 0x12345678 }
uint z = a;
y = z;
}
}
// ====
// compileViaYul: true
// ----
// f() -> 0x78