Open lucaswerkmeister opened 10 years ago
Well if you check the definition of CaseTypes
in the spec, you'll see that the thing that follows of
isn't actually an arbitrary type expression. Rather, it's a list of types, with I
as punctuation.
So actually this is intentional.
Okay, but then I guess it’s a bit confusing... “X?
means Null|X
for any type X
” reads to me as if replacing X|Null
with X?
and vice versa should never have any effect, but in this case it does make a difference.
Actually, looking at the grammar, I don’t understand why this isn’t accepted. caseTypes
takes an abbreviatedType
, which includes optional types.
The spec says (3.2.8, 1.0, current) that
however, you can’t actually use it in generic type constraints:
I can’t find any mention of this in the section on generic type constraints (3.5.3, 1.0, current).
Is this intentional, or an oversight in the grammar/typechecker?