eclipse-archived/ceylon

Unclear error message when type parameter satisfying union

Opened this issue · 2 comments

xkr47 commented
void foo<T>(T t) given T satisfies String|Integer {}

.. gives the error for I of Integer:

Incorrect syntax: mismatched token Integer expecting & operator

This is on try.ceylon-lang.org. In IntelliJ IDEA I get a slightly more verbose message revealing the actual error:

multiple class upper bounds are not yet supported
incorrect syntax
mismatched token Integer expecting & operator

xkr47 commented

It gets hilarious if I feed the troll with a &:

void foo<T>(T t) given T satisfies String|&Integer {}

gives (in try.ceylon-lang.org):

Incorrect syntax: mismatched token & expecting & operator

xkr47 commented

Also, it wouid be handy if it actually wasn't an error :)