You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of course we cannot assume that the type parameter t will always be a primitive, since it means that the field f in Foo will never be traced! We have similar problems when using polymorphic arrays (replace Foo<t> by [t] to see the problem). Replacing ENCORE_PRIMITIVE by _this->_enc__type_t solves the problem.
The translation from encore types to runtime types is performed in CodeGen.Type, and for type variables it hets the default case, which is ENCORE_PRIMTIVE (it should probably be an error instead so that we can avoid these problems in the future). In polymorphic classes, the runtime types of the type parameters are stored in fields (see above), but this won't be the case when we have polymorphic functions and methods. Currently we have polymorphic anonymous functions, but there the runtime type of type parameters are not available (which probably causes bugs already). I suggest we "fix" this temporarily by translating type variables to the field lookups mentioned above and live with the buggy anonymous functions until we fix them properly (together with polymorphic functions).
The text was updated successfully, but these errors were encountered:
The following program has a polymorphic class that stores another polymorphic class:
Looking at the generated function for the constructor of
Bar
, we see that a newFoo
is created, whose runtime type isENCORE_PRIMITIVE
:Of course we cannot assume that the type parameter
t
will always be a primitive, since it means that the fieldf
inFoo
will never be traced! We have similar problems when using polymorphic arrays (replaceFoo<t>
by[t]
to see the problem). ReplacingENCORE_PRIMITIVE
by_this->_enc__type_t
solves the problem.The translation from encore types to runtime types is performed in
CodeGen.Type
, and for type variables it hets the default case, which isENCORE_PRIMTIVE
(it should probably be an error instead so that we can avoid these problems in the future). In polymorphic classes, the runtime types of the type parameters are stored in fields (see above), but this won't be the case when we have polymorphic functions and methods. Currently we have polymorphic anonymous functions, but there the runtime type of type parameters are not available (which probably causes bugs already). I suggest we "fix" this temporarily by translating type variables to the field lookups mentioned above and live with the buggy anonymous functions until we fix them properly (together with polymorphic functions).The text was updated successfully, but these errors were encountered: