mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Added sameType check for fromType and toType in YulUtilFunctions.cpp and relevant tests in semanticTests
This commit is contained in:
parent
e49780362b
commit
7cc7a0f183
@ -4,26 +4,34 @@ contract C {
|
||||
function testFunction3() public {}
|
||||
|
||||
|
||||
function() external [3] externalArray0;
|
||||
function() external [3] externalArray1 = [
|
||||
function() external [] externalArray0;
|
||||
function() external [] externalArray1;
|
||||
|
||||
function() internal [] internalArray0;
|
||||
function() internal [] internalArray1;
|
||||
|
||||
constructor() {
|
||||
externalArray0 = new function() external[] (3);
|
||||
externalArray1 = [
|
||||
this.testFunction1,
|
||||
this.testFunction2,
|
||||
this.testFunction3
|
||||
];
|
||||
|
||||
internalArray0 = new function() internal[] (3);
|
||||
internalArray1 = [
|
||||
testFunction1,
|
||||
testFunction2,
|
||||
testFunction3
|
||||
];
|
||||
}
|
||||
|
||||
function copyExternalStorageArrayOfFunctionType() external returns (bool) {
|
||||
assert(keccak256(abi.encode(externalArray0)) != keccak256(abi.encode(externalArray1)));
|
||||
externalArray0 = externalArray1;
|
||||
return keccak256(abi.encode(externalArray0)) == keccak256(abi.encode(externalArray1));
|
||||
}
|
||||
|
||||
function() internal [3] internalArray0;
|
||||
function() internal [3] internalArray1 = [
|
||||
testFunction1,
|
||||
testFunction2,
|
||||
testFunction3
|
||||
];
|
||||
|
||||
function copyInternalArrayOfFunctionType() external returns (bool) {
|
||||
internalArray0 = internalArray1;
|
||||
assert(internalArray0.length == 3);
|
||||
@ -39,5 +47,7 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// copyExternalStorageArrayOfFunctionType() -> true
|
||||
// gas legacy: 103412
|
||||
// gas irOptimized: 104701
|
||||
// gas legacy: 108725
|
||||
// gas legacyOptimized: 102441
|
||||
// copyInternalArrayOfFunctionType() -> true
|
||||
|
@ -3,13 +3,30 @@ contract C {
|
||||
function testFunction2() public view {}
|
||||
function testFunction3() public pure {}
|
||||
|
||||
function() external [3] externalArray0;
|
||||
function() external [3] externalArray1 = [
|
||||
|
||||
function() external [] externalArray0;
|
||||
function() external [] externalArray1;
|
||||
|
||||
function() internal [] internalArray0;
|
||||
function() internal [] internalArray1;
|
||||
|
||||
constructor() {
|
||||
externalArray0 = new function() external[] (3);
|
||||
externalArray1 = [
|
||||
this.testFunction1,
|
||||
this.testFunction2,
|
||||
this.testFunction3
|
||||
];
|
||||
|
||||
internalArray0 = new function() internal[] (3);
|
||||
internalArray1 = [
|
||||
testFunction1,
|
||||
testFunction2,
|
||||
testFunction3
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
function copyExternalStorageArraysOfFunctionType() external returns (bool)
|
||||
{
|
||||
assert(keccak256(abi.encodePacked(externalArray0)) != keccak256(abi.encodePacked(externalArray1)));
|
||||
@ -17,13 +34,6 @@ contract C {
|
||||
return keccak256(abi.encodePacked(externalArray0)) == keccak256(abi.encodePacked(externalArray1));
|
||||
}
|
||||
|
||||
function() internal [3] internalArray0;
|
||||
function() internal [3] internalArray1 = [
|
||||
testFunction1,
|
||||
testFunction2,
|
||||
testFunction3
|
||||
];
|
||||
|
||||
function copyInternalArrayOfFunctionType() external returns (bool)
|
||||
{
|
||||
internalArray0 = internalArray1;
|
||||
@ -40,6 +50,8 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// copyExternalStorageArraysOfFunctionType() -> true
|
||||
// gas legacy: 103398
|
||||
// gas irOptimized: 104372
|
||||
// gas legacy: 108462
|
||||
// gas legacyOptimized: 102174
|
||||
// copyInternalArrayOfFunctionType() -> true
|
||||
// gas legacy: 104178
|
||||
|
Loading…
Reference in New Issue
Block a user