Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

backend error with case destructuring #6330

Closed
jvasileff opened this issue Jun 23, 2016 · 5 comments
Closed

backend error with case destructuring #6330

jvasileff opened this issue Jun 23, 2016 · 5 comments

Comments

@jvasileff
Copy link
Contributor

This type-checks:

    String[2] tup = ["one", "two"];
    switch(tup)
    case ([a,b]) { String x = b; }

but results in

source/simple/run.ceylon:7: error: compiler bug: unhandled declaration unknown with type UnknownType at com.redhat.ceylon.compiler.java.codegen.AbstractTransformer.makeTypeTest(AbstractTransformer.java:4538)
    switch(tup)
    ^
1 error
1 warning
@jvasileff
Copy link
Contributor Author

@gavinking I assume this is a backend bug and not a typechecker bug?

@gavinking
Copy link
Contributor

Well, yeah, I suppose. Though I'm not sure that it was really 100% intentionally intended that this would work, so I'm not surprised that it wasn't tested. Still, I see no good reason to actively prevent you from writing that.

@gavinking gavinking added this to the 1.2.3 milestone Jun 23, 2016
@FroMage FroMage self-assigned this Aug 3, 2016
@FroMage
Copy link
Contributor

FroMage commented Aug 3, 2016

OK, so what's the thing that makes this special? I fail to see it. Apparently I have an IsCase with a iscase.type that is an UnknownType. I assume the typechecker should infer that type to be what's in iscase.variable, no?

@jvasileff
Copy link
Contributor Author

That's similar to what I though (ceylon/ceylon.ast#116 (comment)), the ast seems incomplete

@FroMage FroMage closed this as completed Aug 3, 2016
FroMage added a commit that referenced this issue Aug 3, 2016
@FroMage
Copy link
Contributor

FroMage commented Aug 3, 2016

Whatever, I use the type of the Variable, that works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants