Skip to content

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

Closed
@kraktus

Description

@kraktus

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?

Metadata

Metadata

Assignees

Labels

area:metaprogramming:quotesIssues related to quotes and splicesarea:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions