mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add tests to increase coverage of TypeChecker
This commit is contained in:
parent
d41ffd1dcf
commit
feae01f042
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public returns (uint a, uint b) {
|
||||
a += (1, 1);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (72-83): Operator += not compatible with types uint256 and tuple(int_const 1,int_const 1)
|
@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() pure public {
|
||||
uint x;
|
||||
(x, ) = ([100e100]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (78-85): Invalid mobile type.
|
@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
struct S { uint a; uint b; mapping(uint=>uint) c; }
|
||||
|
||||
function f() public {
|
||||
S memory s = S({a: 1});
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (117-126): Wrong argument count for struct constructor: 1 arguments given but expected 2. Members that have to be skipped in memory: c
|
@ -0,0 +1,9 @@
|
||||
contract test {
|
||||
function f() public {
|
||||
uint(1, 1);
|
||||
uint({arg:1});
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (50-60): Exactly one argument expected for explicit type conversion.
|
||||
// TypeError: (70-83): Type conversion cannot allow named arguments.
|
Loading…
Reference in New Issue
Block a user