isImplicitlyConvertibleTo(): Add better error messages

This commit is contained in:
Mathias Baumann
2019-03-11 13:38:02 +01:00
parent dce8469534
commit d70cb375cf
6 changed files with 28 additions and 5 deletions
@@ -6,4 +6,4 @@ contract Derived2 is Base {
constructor() Base(2) public { }
}
// ----
// TypeError: (74-77): Invalid type for argument in constructor call. Invalid implicit conversion from int_const 300 to uint8 requested.
// TypeError: (74-77): Invalid type for argument in constructor call. Invalid implicit conversion from int_const 300 to uint8 requested. Literal is too large to fit in uint8
@@ -5,4 +5,4 @@ contract test {
}
}
// ----
// TypeError: (75-92): Type ufixed128x18 is not implicitly convertible to expected type ufixed248x8.
// TypeError: (75-92): Type ufixed128x18 is not implicitly convertible to expected type ufixed248x8. Too many fractional digits.
@@ -0,0 +1,7 @@
contract c {
function f() public pure {
uint a = -1;
}
}
// ----
// TypeError: (52-63): Type int_const -1 is not implicitly convertible to expected type uint256. Cannot implicitly convert signed literal to unsigned type.
@@ -0,0 +1,7 @@
contract c {
function f() public pure {
uint8 a = 256;
}
}
// ----
// TypeError: (52-65): Type int_const 256 is not implicitly convertible to expected type uint8. Literal is too large to fit in uint8