Skip to content

Type pattern variables not supported at the top level of match types and inline matches #6018

@milessabin

Description

@milessabin

The following is rejected,

import scala.compiletime._

object Test {
  type Foo[T] = T match {
    case f[Int] => f[String]
  }

  val ls: Foo[List[Int]] = ???
}

object Test2 {
  inline def summon[T] = implicit match {
    case t: T => t
  }

  inline def foo[T] = inline erasedValue[T] match {
    case _: f[Int] => summon[f[String]]
  }
}

with,

-- [E006] Unbound Identifier Error: tests/pos/match-bugs.scala:5:9 -------------
5 |    case f[Int] => f[String]
  |         ^
  |         Not found: type f

longer explanation available when compiling with `-explain`
-- [E006] Unbound Identifier Error: tests/pos/match-bugs.scala:5:19 ------------
5 |    case f[Int] => f[String]
  |                   ^
  |                   Not found: type f

longer explanation available when compiling with `-explain`
-- [E006] Unbound Identifier Error: tests/pos/match-bugs.scala:17:12 -----------
17 |    case _: f[Int] => summon[f[String]]
   |            ^
   |            Not found: type f

longer explanation available when compiling with `-explain`
-- [E006] Unbound Identifier Error: tests/pos/match-bugs.scala:17:29 -----------
17 |    case _: f[Int] => summon[f[String]]
   |                             ^
   |                             Not found: type f

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions