Skip to content

Inline match/match type bound HK type variables are miskinded on the RHS #6014

Closed
@milessabin

Description

@milessabin

Compiling the following,

import scala.compiletime._

object Test1 {
  type Foo[F[_]]
  type Bar[T] = T match {
    case Foo[f] => f[Int]
  }
}

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

  class Foo[F[_]]

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

Fails similarly in both cases with the occurrences of f on the RHS of the case being reported as not taking type parameters,

-- [E053] Reference Error: tests/pos/match-bugs.scala:6:19 ---------------------
6 |    case Foo[f] => f[Int]
  |                   ^^^^^^
  |                   f does not take type parameters

longer explanation available when compiling with `-explain`
-- [E053] Reference Error: tests/pos/match-bugs.scala:18:29 --------------------
18 |    case _: Foo[f] => summon[f[Int]]
   |                             ^^^^^^
   |                             f does not take type parameters

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions