Skip to content

Bogus unreachability warning when matching on quoted types #9489

Closed
@szeiger

Description

@szeiger
import scala.quoted._

def summonTypedType[T : Type](using QuoteContext): String = '[T] match {
  case '[Boolean] => "Boolean"
  case '[Byte] => "Byte"
  case _ => "Other"
}

In 0.26.0-RC1 this results in a warning even though the case is reachable and will be taken correctly when evaluating the match:

[warn] -- [E030] Match case Unreachable Warning: /mnt/c/Users/szeiger/code/dottyquery/src/main/scala/dottyquery/Test.scala:67:9
[warn] 67 |    case '[Byte] => "Byte"
[warn]    |         ^^^^^^^
[warn]    |         Unreachable case

Possibly related to #6255 which describes a similar issue for Expr.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions