Skip to content

ClassCastException when matching on ValueOf #12366

Open
@OlivierBlanvillain

Description

@OlivierBlanvillain

Here is a variation of tests/run/i12194.scala that leads to a ClassCastException:

import scala.compiletime.package$package.summonAll

@main def Test(): Unit = {
  val list: List[ValueOf["foo"] | ValueOf["bar"]] =
    summonAll[Tuple.Map[("foo", "bar"), ValueOf]].toList

  println(list.map {
    case str: ValueOf[_]  str.value
    // java.lang.ClassCastException: scala.ValueOf cannot be cast to java.lang.String              
  })
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions