Skip to content
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

-source:future-migration generating warnings on TypeRepr matches #21282

Closed
kraktus opened this issue Jul 27, 2024 · 1 comment · Fixed by #21377
Closed

-source:future-migration generating warnings on TypeRepr matches #21282

kraktus opened this issue Jul 27, 2024 · 1 comment · Fixed by #21377
Assignees
Labels
area:metaprogramming:quotes Issues related to quotes and splices area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement
Milestone

Comments

@kraktus
Copy link

kraktus commented Jul 27, 2024

Compiler version

3.4.2

Minimized example

import scala.quoted.*

private def isUnionCanonicalImpl[U: Type](using Quotes): Expr[Unit] =
  import quotes.reflect.*
  val u = TypeRepr.of[U].dealiasKeepOpaques

  def inner[U: Type](s: Set[TypeRepr], tr: TypeRepr): Set[TypeRepr] =
    tr.dealiasKeepOpaques match
      case OrType(a, b) =>
        val ss = inner[U](s, a)
        inner[U](ss, b)
      case x if s.contains(x) =>
        report.errorAndAbort(s"Type ${x.show} multiple times (CHECK ALIASES) in union ${u.show}")
      case x => s + x
  inner(Set.empty, u)
  '{ () }
// build.sbt
scalacOptions ++= Seq(
  "-source:future-migration"
)

https://scastie.scala-lang.org/wKXmWPdTT2u4crw5NBy3wQ

Output Error/Warning message

Couldn't find an easy way to get full text version of scatie warning
image

[warn] 59 |      case OrType(a, b) =>
[warn]    |           ^^^^^^^^^^^^
[warn]    |           pattern selector should be an instance of Matchable,,
[warn]    |           but it has unmatchable type x$1.reflect.TypeRepr instead

Expected

no warning?

@kraktus kraktus added area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 27, 2024
@Gedochao Gedochao added area:metaprogramming:quotes Issues related to quotes and splices and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 30, 2024
@Gedochao
Copy link
Contributor

reproducible on 3.5.0-RC6, 3.5.1-RC1 & 3.6.0-RC1-bin-20240729-4429d73-NIGHTLY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:metaprogramming:quotes Issues related to quotes and splices area:reporting Error reporting including formatting, implicit suggestions, etc better-errors Issues concerned with improving confusing/unhelpful diagnostic messages itype:enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants