Skip to content

Compiler errors about type wildcards still sometimes use the old deprecated syntax #19608

Open
@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

Compile error should not rewrite case Bar[?] => Nothing to case Bar[_] => Nothing. A fortiori when the compiler options -Ykind-projector:underscores and -source:future are used.

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