Add tests to increase coverage of TypeChecker

This commit is contained in:
Mathias Baumann 2019-02-11 11:23:56 +01:00
parent d41ffd1dcf
commit feae01f042
4 changed files with 33 additions and 0 deletions

View File

@ -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)

View File

@ -0,0 +1,8 @@
contract C {
function f() pure public {
uint x;
(x, ) = ([100e100]);
}
}
// ----
// TypeError: (78-85): Invalid mobile type.

View File

@ -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

View File

@ -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.