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

Normalise mirrorType for mirror Synthesis #19199

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 compiler/src/dotty/tools/dotc/typer/Synthesizer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ class Synthesizer(typer: Typer)(using @constructorOnly c: Context):
* or a TermRef to a singleton value. These are
* the base elements required to generate a mirror.
*/
def reduce(mirroredType: Type)(using Context): Either[String, MirrorSource] = mirroredType match
def reduce(mirroredType: Type)(using Context): Either[String, MirrorSource] = mirroredType.normalized match
EugeneFlesselle marked this conversation as resolved.
Show resolved Hide resolved
case tp: TypeRef =>
val sym = tp.symbol
if sym.isClass then // direct ref to a class, not an alias
Expand Down
13 changes: 13 additions & 0 deletions tests/pos/i19198.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import deriving.Mirror
import compiletime.summonInline

inline def check1[Tps <: NonEmptyTuple]: Unit =
summonInline[Mirror.Of[Tuple.Head[Tps]]]

inline def check2[Tps <: NonEmptyTuple]: Unit =
type FromType = Tuple.Head[Tps]
summonInline[Mirror.Of[FromType]]

@main def Test: Unit =
check1[Option[Int] *: EmptyTuple] // Ok
check2[Option[Int] *: EmptyTuple] // Error: FromType is widened to Any in Syntheziser
Loading