Multiple aspects, let's start with the example that triggered this:
CL-USER> (cl-form-types:form-type `(aref (the (simple-array single-float 1) a)
(the (unsigned-byte 32 i)))
nil)
(VALUES T &OPTIONAL)
It should be (form-type (first form) env) instead of (form-type form env), and form isn't a form but rest of the form arguments.
One needs to additionally check if the first element of the returned type (the value of element-type) is a list with its first element cl:array or cl:simple-array or such.
Applying fix 1, we find that element-type gets the value (and (simple-array single-float) t). To keep things simple, if type1 is a subtype of type2, and combination can be avoided. I'm unsure if you want to apply this (and similar!) fix in combine-values-types or in the special-form-type specializing on cl:the. EDIT: Another factor is the form-type of (the type-1 form-2) should not result in type-1, because CLHS allows implementations to allow form-2 to be of a type other than type-2.
PS: Would it be recommendable to use spaces instead of tabs for indentation?
https://github.com/alex-gutev/cl-form-types/blob/7a68e67abca423e622349ef0ca97b73fa3f6c212/src/cl-functions.lisp#L141-L145
Multiple aspects, let's start with the example that triggered this:
(form-type (first form) env)
instead of(form-type form env)
, andform
isn't a form but rest of the form arguments.element-type
) is a list with its first elementcl:array
orcl:simple-array
or such.element-type
gets the value(and (simple-array single-float) t)
. To keep things simple, iftype1
is a subtype oftype2
,and
combination can be avoided. I'm unsure if you want to apply this (and similar!) fix incombine-values-types
or in thespecial-form-type
specializing oncl:the
. EDIT: Another factor is the form-type of(the type-1 form-2)
should not result intype-1
, because CLHS allows implementations to allowform-2
to be of a type other thantype-2
.PS: Would it be recommendable to use spaces instead of tabs for indentation?