mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add type().min/max for enums
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
contract test {
|
||||
enum MinMax { A, B, C, D }
|
||||
|
||||
function min() public returns(uint) { return uint(type(MinMax).min); }
|
||||
function max() public returns(uint) { return uint(type(MinMax).max); }
|
||||
}
|
||||
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// min() -> 0
|
||||
// max() -> 3
|
||||
@@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (93-98): Invalid type for argument in the function call. A contract type or an integer type is required, but type(bytes) provided.
|
||||
// TypeError 4259: (93-98): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(bytes) provided.
|
||||
|
||||
@@ -10,4 +10,4 @@ contract SuperTest is Other {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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.
|
||||
// TypeError 4259: (177-182): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(contract super SuperTest) provided.
|
||||
|
||||
@@ -14,4 +14,4 @@ abstract contract Test is ERC165 {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// 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.
|
||||
// TypeError 4259: (592-597): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(contract super Test) provided.
|
||||
|
||||
@@ -50,4 +50,4 @@ contract D is B, C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (426-431): Invalid type for argument in the function call. A contract type or an integer type is required, but type(contract super B) provided.
|
||||
// TypeError 4259: (426-431): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(contract super B) provided.
|
||||
|
||||
@@ -4,4 +4,4 @@ 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: (65-75): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(contract Test) provided.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4259: (154-155): Invalid type for argument in the function call. A contract type or an integer type is required, but type(struct Test.S) provided.
|
||||
// TypeError 4259: (154-155): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(struct Test.S) provided.
|
||||
|
||||
@@ -14,4 +14,4 @@ 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 4259: (176-183): Invalid type for argument in the function call. An enum type, contract type or an integer type is required, but type(address) provided.
|
||||
|
||||
Reference in New Issue
Block a user