mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Restrict mobile types of function types.
Move ternary tests to semanticTests
This commit is contained in:
committed by
Nikola Matic
parent
2c82873a2c
commit
110e2a656d
@@ -0,0 +1,11 @@
|
||||
error MyCustomError(uint, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
true ? MyCustomError : MyCustomError;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 9717: (93-106): Invalid mobile type in true expression.
|
||||
// TypeError 3703: (109-122): Invalid mobile type in false expression.
|
||||
@@ -1,18 +0,0 @@
|
||||
error MyCustomError(uint, bool);
|
||||
error MyCustomError2(uint, bool);
|
||||
error MyCustomError3(uint, bool, bool);
|
||||
|
||||
contract C {
|
||||
function f() pure public {
|
||||
true ? MyCustomError : MyCustomError;
|
||||
true ? MyCustomError : MyCustomError2;
|
||||
true ? MyCustomError : MyCustomError3;
|
||||
true ? MyCustomError : true;
|
||||
true ? true : MyCustomError;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 1080: (253-290): True expression's type error MyCustomError(uint256,bool) does not match false expression's type error MyCustomError3(uint256,bool,bool).
|
||||
// TypeError 1080: (300-327): True expression's type error MyCustomError(uint256,bool) does not match false expression's type bool.
|
||||
// TypeError 1080: (337-364): True expression's type bool does not match false expression's type error MyCustomError(uint256,bool).
|
||||
Reference in New Issue
Block a user