Disallow meta type on super.

This commit is contained in:
chriseth
2020-12-02 15:43:18 +01:00
parent a6158e65c2
commit 52c49aebe8
8 changed files with 11 additions and 30 deletions
@@ -21,13 +21,9 @@ contract Test is C {
function i() public pure returns (string memory) {
return type(I).name;
}
function j() public pure returns (string memory) {
return type(super).name;
}
}
// ----
// c() -> 0x20, 1, "C"
// a() -> 0x20, 1, "A"
// i() -> 0x20, 1, "I"
// j() -> 0x20, 1, "C"
@@ -10,5 +10,4 @@ contract SuperTest is Other {
}
}
// ----
// TypeError 3625: (172-196): "creationCode" and "runtimeCode" are not available for the "super" contract.
// TypeError 3625: (272-295): "creationCode" and "runtimeCode" are not available for the "super" contract.
// TypeError 4259: (177-182): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract super SuperTest) provided.
@@ -14,4 +14,4 @@ abstract contract Test is ERC165 {
}
}
// ----
// TypeError 9582: (587-610): Member "interfaceID" not found or not visible after argument-dependent lookup in type(contract super Test).
// TypeError 4259: (592-597): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract super Test) provided.
@@ -49,6 +49,5 @@ contract D is B, C {
return true;
}
}
// ----
// f() -> true
// TypeError 4259: (440-445): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract super B) provided.
@@ -5,4 +5,3 @@ contract Test {
}
// ----
// TypeError 4259: (65-75): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract Test) provided.
// TypeError 4259: (60-76): Invalid type for argument in the function call. A contract type or an integer type is required, but tuple() provided.
@@ -15,4 +15,3 @@ contract C {
// TypeError 5347: (72-76): Try can only be used with external function calls and contract creation calls.
// TypeError 2536: (119-128): Try can only be used with external function calls and contract creation calls.
// TypeError 4259: (176-183): Invalid type for argument in the function call. A contract type or an integer type is required, but type(address) provided.
// TypeError 2536: (171-184): Try can only be used with external function calls and contract creation calls.