dylan-lang/opendylan — Issue #117: Compile error in emitted C code with limited vector types
Author: AndrewGlynn
Created: 2011-12-16 05:23:31+00:00
State: open

The following code (in a library and module using nothing but the dylan library/module):

define method negative (a :: limited(, of: , size: 1))
a[0] := a[0];
end;

Emits C code that dies with the following error messages:

tests.c: In function ‘KnegativeVKdMtestsM0I’:

tests.c:249: error: incompatible types in assignment
tests.c:258: error: incompatible types in assignment
tests.c:262: error: incompatible type for argument 1 of ‘primitive_raw_as_single_float’
tests.c:266: error: incompatible types in assignment

It appears to be getting confused about boxed vs unboxed floats (or something along those lines).

The issue goes away if the "size" keyword is removed from the limited type, but otherwise is independent of the actual values of 'size'.

The issue goes away if we rename the method so that it defines a fresh generic rather than adding a method to an existing one.

The issue goes away for types other than `` or `` (at least of the few I've checked, including ``, ``, ``).