Skip to content

Bogus unreachability warning when matching on quoted types #9489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
szeiger opened this issue Aug 3, 2020 · 0 comments · Fixed by #9501
Closed

Bogus unreachability warning when matching on quoted types #9489

szeiger opened this issue Aug 3, 2020 · 0 comments · Fixed by #9501

Comments

@szeiger
Copy link
Contributor

szeiger commented Aug 3, 2020

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.

@liufengyun liufengyun self-assigned this Aug 3, 2020
liufengyun added a commit to dotty-staging/dotty that referenced this issue Aug 5, 2020
liufengyun added a commit to dotty-staging/dotty that referenced this issue Aug 5, 2020
liufengyun added a commit that referenced this issue Aug 5, 2020
Fix #9489: skip redundancy check for Type[T]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants