Subject: bug#66615: 30.0.50; Inconsistent 'number-or-marker' type definition in the cl- machinery

From: Stefan Monnier <[email-masked]>
Date: Thu, 19 Oct 2023 18:34:39 -0400

> I've to question now the following entry introduced in
> `cl--typeof-types' for correctness:
>
> (integer number integer-or-marker number-or-marker atom)
>
> The doc says :
> Each element has the form (TYPE . SUPERTYPES) where TYPE is one of
> the symbols returned by ‘type-of’, and SUPERTYPES is the list of its
> supertypes from the most specific to least specific.
>
> And indeed not every 'number' is an 'integer-or-marker'.

The subtype relation doesn't derive from a tree but a DAG so the
SUPERTYPES represents *a* linearization of the parents but just because
`number` appears before `integer-or-marker` doesn't mean that it's
a subtype of it.  It just means I judged that it should be considered
"more specific".

The same effect is in play for:

    (null symbol list sequence atom)

where clearly `symbol` is a subtype of neither `list` nor `sequence`.

> I suspect that's the reason why this commit introduces few failures in
> the native-comp testsuite.

If you need to know the list of supertypes of `number`, we could add
that info explicitly, or you could "guess" it as the intersection of all
the types that appear after `number` in `cl--typeof-types`:

    (integer number integer-or-marker number-or-marker atom)
    [...]
    (float number number-or-marker atom)
    [...]

i.e. the intersection of (integer-or-marker number-or-marker atom)
and (number-or-marker atom).

        Stefan