ceylon / ceylon-compiler

DEPRECATED
GNU General Public License v2.0
138 stars 36 forks source link

incompatible types with if expression #2423

Open jvasileff opened 8 years ago

jvasileff commented 8 years ago

The code below results in a backend error:

class Li<out Element>(shared Element* items) {}

shared void run() {
    Li<Li<String>> f = Li(Li("#1"));
    Li<String>? ns = f.items[0];
    value n = if (is Li<Anything> ns) then ns.items else (ns of Li<String>?); // ok
    value o = if (is Li<Anything> ns) then ns.items else ns; // error

    //Incompatible types
    //required: ceylon.language.Sequential<? extends ceylon.language.String>
    //found:    simple.Li<capture#1 of ? extends ceylon.language.String>
}

(Found when looking at https://github.com/ceylon/ceylon-compiler/issues/2422)