This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: GSOC | Extending Common Lisp support
On 04/26/2012 03:18 PM, Charles Turner wrote:
(define (test)
(let ((x :: integer 10.5))
(* x x)))
/dev/stdin:2:23: warning - type DFloNum is incompatible with required
type integer
/dev/stdin:3:5: warning - cannot convert literal (of type
gnu.math.DFloNum) to Type integer
So far, as expected. But when you type (test), you get:
Value '110.25' has wrong type (DFloNum) (expected: integer)
This looks like a bug in constant folding.
We're multiplying 10.5 and 10.5 - and eliminating the cast/conversion
of 10.5 to integer. In this case we know the cast always
fails, so we shouldn't do the constant-folding. But even if the
cast succeeds, we need to used the converted value. I recently fixed
a bug to do that, so it is possible it works for the non-fail case.
This issue seems related to the unreachable-code issue. I.e. the
type x really should be "unreachable" or Type.neverReturnsType.
I am looking at improvements in the area of unreachable code,
which I intend to check in soon (i.e. before the 1.12 release).
Perhaps you could record this as case as a Savannah bug so we
don't forget this?
--
--Per Bothner
per@bothner.com http://per.bothner.com/