DRY-249: No narrowing conversion generated for literal primitives
This is actually a @todo in AssignmentConversions.str: “Additional conversion rules for constant expressions (5.2)”.I’m not sure how this should be integrated, since the current strategies determine the assignment conversions on basis of the type, not the value…
For example this doesn’t generate a conversion:
Submitted on 29 March 2007 at 12:29
class Foo {
byte b = 1;
}
Issue Log
DRY-249, martin:
Yes, this is a bit tricky. The whole constant expression thing is a bit messy in the current Dryad (basically there is no support checking if something is constant).One of the problems is that we actually reliably need to evaluate constant expressions. I think doing this in C is not acceptable (possible different semantics for floats, overflow, etc). We link with Java these days, so maybe it is possible to implement a small Java library for constant folding.
Log in to post comments