Skip to content

Match type on parameterized trait doesn't preserve input parameter in type variable #14151

Closed
@s5bug

Description

@s5bug

Compiler version

3.1.0, 3.1.1-RC1, 3.1.1-RC2

Minimized code

sealed trait BoundedPair[A, B <: A]

type Second[A, T <: BoundedPair[A, _ <: A]] <: A = T match {
  case BoundedPair[A, b] => b
}

Output

Found:    b
Required: A

where:    b is a type in type Second with bounds <: Playground.BoundedPair[?, ?]#A

Expectation

Second[Animal, BoundedPair[Animal, Cat]]Cat

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions