Skip to content

GADT: superclass' type param instantiated to union type in a subclass does not infer properly #17075

@TomasMikula

Description

@TomasMikula

Compiler version

3.2.2
3.3.0-RC3

Minimized code

enum Foo[A]: case Bar[X, Y]() extends Foo[X | Y] def go[A](foo: Foo[A]): Unit = foo match case b: Foo.Bar[x, y] => summon[(x | y) <:< A] // OK summon[(x | y) =:= A] // KO: Cannot prove that x | y =:= A.

Output

Cannot prove that x | y =:= A. where: x is a type in method go with bounds <: A y is a type in method go with bounds <: A

Expectation

Should compile.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions