Skip to content

Assertion failure when check the subtype relation #11221

Open
@Ang9876

Description

@Ang9876

Compiler version

Scala compiler version 3.0.0-M3

Minimized code

This code is inspired by tests/pos/i5735.scala.

type Nested[X, P[_, _], N] = X match {
    case N => N
    case P[a, b] => P[a, Nested[b, P, N]]
  }

def foo[T, Y >: T <: Nested[T, Tuple2, Unit]](t: T): T = t 

Output

It can be compiled without -Yno-deep-subtypes. But with -Yno-deep-subtypes, the result is

assertion failure for Any <:< Unit, frozen = true
assertion failure for T <:< Unit, frozen = true
assertion failure for Nested[T, [T1, T2] =>> (T1, T2), Unit] <:< Unit, frozen = true
assertion failure for T <:< Unit, frozen = true
assertion failure for Nested[T, [T1, T2] =>> (T1, T2), Unit] <:< Unit, frozen = true
...
...

Expectation

It seems that the assertion failure occurs when the compiler checks Y <: Nested[T, Tuple2, Unit].

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions