mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
isImplicitlyConvertibleTo(): Add better error messages
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
Reference in New Issue
Block a user