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

Bound TypeRepr by Matchable in Quotes #21377

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/src/scala/quoted/Quotes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2640,7 +2640,7 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
// ----- Types ----------------------------------------------------

/** A type, type constructors, type bounds or NoPrefix */
type TypeRepr
type TypeRepr <: Matchable

/** Module object of `type TypeRepr` */
val TypeRepr: TypeReprModule
Expand Down
18 changes: 18 additions & 0 deletions tests/pos/i21282.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//> using options -Xfatal-warnings -source:future-migration

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)
'{ () }
Loading