eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
395 stars 62 forks source link

JS-related switch pattern error #7375

Open arseniiv opened 6 years ago

arseniiv commented 6 years ago

Running the code

switch ([1, 2, 3])
case ([Object head, Object* args]) {
    printAll { head, args };
}
else { print("error"); }

for JS backend (see https://try.ceylon-lang.org/?gist=c7c1a51ea100cc6a16c8de3aa34971cb) prints “error”.

Alternative example:

switch ([1, 2, 3] of [Object,Object*])
case ([Object head, Object* args]) {
    printAll { head, args };
}

gives runtime error ceylon.language::Exception "Supposedly exhaustive switch was not exhaustive".

gavinking commented 5 years ago

Confirmed. Thanks for reporting.