alex-gutev / cl-form-types

Library for determining the types of Common Lisp forms based on information stored in the environment.
MIT License
19 stars 1 forks source link

For special-form-type CL:THE avoid using value-form on CCL #18

Closed digikar99 closed 1 year ago

digikar99 commented 1 year ago

On CCL, (CL:AREF (THE (SIMPLE-ARRAY SINGLE-FLOAT) A) 0) can compiler macroexpand into

(CL:THE SINGLE-FLOAT (CL:AREF (THE (SIMPLE-ARRAY SINGLE-FLOAT) A) 0))

And this can subsequently lead to infinite expansion and stack overflow.

alex-gutev commented 1 year ago

This in theory make the resulting type slightly less specific on CCL, e.g. if you have (THE INTEGER 10) the resulting type will be INTEGER on CCL whereas it will be (AND INTEGER (EQL 10)) which simplifies to (EQL 10) on the remaining implementations. I guess it's ok in the cases where THE is used. What do you think?

digikar99 commented 1 year ago

On another thought, may be a different way to deal with this issue could be to have a blacklist of compiler macros which will have CL:AREF as one of its members on CCL.

But I think, hold on this PR for some time. I'm also running into value stackoverflow errors on CCL stemming from different sources. I get this error while trying to run polymorphic-function tests, as well as while loading extensible-compound-types-interfaces with :extensible-compound-types as a cl:*feature*. I will debug this and issue a more complete PR.