Custom operators can't end in <
but should be able to
#6
Labels
bug
Something isn't working
error-for-valid-code
The grammar causes a parsing error for some code that should parse
With the current setup, ending a custom operator in a
<
would create ambiguity with function type parameters. Take, for example, this case:If my operator were allowed to end in
<
, this would be interpreted as implementing??<
, and would fail shortly thereafter sinceV: Value >
is not expected here. Somehow the actualswiftc
is able to look past this and the code compiles just fine.I've hacked around this for now by excluding
<
from being a legal last character in custom operators. This is almost always fine, but is not correct at all. I can think of one way to fix this (there may be others):externals
-- see issue 5.externals
that flags that we're in a function declaration position, so thatscanner.c
can special case this.custom_operator
inscanner.c
, if we're in a function declaration, stay one character behind withmark_end
.(
, then lop off the last character of the custom operator (i.e. return without callingmark_end
again).Is there a less weird and special-cased way to do it? Maybe!
The text was updated successfully, but these errors were encountered: