Skip to content

incompatible types with if expression #2423

@jvasileff

Description

@jvasileff

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 #2422)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions