Skip to content

Match type reduction failure when applied to a type containing a bounded wildcard #19607

Closed
@Bersier

Description

@Bersier

Compiler version

3.4.0-RC4

Minimized code

trait Foo
trait Bar[T]

type MatchType[T] = T match
  case Bar[?] => Nothing
  case _ => T

def foo(b: Bar[? >: Foo]): MatchType[b.type] = ???

def bar(b: Bar[? >: Foo]): Nothing = foo(b)

Compiler output

Found:    MatchType[(b : Bar[? >: Foo])]
Required: Nothing

Note: a match type could not be fully reduced:

  trying to reduce  MatchType[(b : Bar[? >: Foo])]
  failed since selector (b : Bar[? >: Foo])
  does not match  case Bar[_] => Nothing
  and cannot be shown to be disjoint from it either.
  Therefore, reduction cannot advance to the remaining case

    case _ => (b : Bar[? >: Foo])

Expectation

No compile error

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions