Skip to content

Recursive match type definitions with upper bound issue #5650

Closed
@flomebul

Description

@flomebul

After the traits definitions:

trait N
trait Z extends N
trait S[P <: N] extends N
The newt match type have an issue:
type T[X <: N] <: N =
  X match {
    case Z => Z
    case S[p] => T[p]
  }

the error is:

5 |    case S[p] => T[p]
  |                 ^^^^
  |              found:         |T[p]
  |              required:      |N
  |
  |              where:    p is a type     | in type T with bounds <:      |N
  |
  |                   |Constraint(
  |                   | uninstVars = ;
  |                   | constrained types =
  |                   | bounds =
  |                   | ordering =
  |                   |)
  |              Subtype trace:
  |                ==>      |T[p] <:<      |N
  |                <==      |T[p] <:<      |N   = false

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