-
Notifications
You must be signed in to change notification settings - Fork 62
Incompatible type of nothing in switch expression with object cases #2001
Comments
[@tombentley] The problem here was that the type of the switch is these days My concern is that |
[@gavinking] We only reify them when they are type args, and according to the spec such types are never inferred. Sent from my iPhone
|
Right. So when constructing a reified type argument I need to ensure I'm not using a
So does that mean this bug is a typechecker bug? |
[@gavinking] @tombentley read again what I just wrote :) |
[@gavinking] Hint: there are no type args in the above code! |
[@tombentley] I assume that means it's not a typechecker bug, and we can expect to find this |
[@gavinking] No, it's not a bug, and yes, the backend needs to be able to accommodate expressions with types like this. |
[@lucaswerkmeister] ```ceylon
shared void run() {
value c = switch (0) case (0) smaller case (1) equal else nothing;
}
required: Comparison
found: Object
The error disappears if both cases evaluate to the same object (e. g.
case (1) smaller
); in that case, the compiler castsnothing
tosmaller_
.As always, generated code,
@noanno
’ed.[Migrated from ceylon/ceylon-compiler#2001]
[Closed at 2015-01-19 12:17:12]
The text was updated successfully, but these errors were encountered: