Skip to content

Spurious 'unreachable code' when pattern matching a compound type including a sealed trait #12771

@noresttherein

Description

@noresttherein

Reproduction steps

Scala version: 2.13.10

in "file1.scala":

	sealed trait T[+X <: E[X]]
	trait S[+X <: E[X]] extends T[X]
	trait A extends T[A]
	trait B extends A with T[B]

	type E[+X <: A with T[X]] =
		A with T[X]

in "file2.scala":

	def test[E1 <: E[E1], E2 <: E[E2]](a :E[E1], b :E[E2]) =
		(a, b) match {
			case (_, _ :B) => 3
			case (_ :B, _) => 2
			case _ => 4
		}

Problem

unreachable code
			case (_ :B, _) => 2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions