Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: X10 2.2.3
-
Labels:None
-
Number of attachments :
Description
I can't coerce a UByte to an Int:
public class ConvUByteToInt { public static def main(argv:Rail[String]!) { val a = (123 as UByte) as Int; } }
/Users/bard/x10/jira/jonv/ConvUByteToInt.x10:3: Cannot cast expression to type.
Expression: (x10.lang.UByte.operator_as(123))
Expression type: x10.lang.UByte
To type: x10.lang.Int
1 error.
Same goes for UShort and ULong, though not UInt.
Issue Links
- is duplicated by
-
XTENLANG-1917
Casts between unsigned and signed types are inconsistent with casts within signed types and within unsigned types
-
-
XTENLANG-1658
can't cast UShort to Int
-
-
XTENLANG-1112
Can't cast a ULong to an Int.
-
- relates to
-
XTENLANG-1626
support casts from Char to integer types
-
(a) This is a conversion, not a coercion.
(b) UByte can be coerced (through an implicit coercion operator) to Byte, which can then be converted to Int. The typechecker ought to find this converter chain.