Skip to content

Test that no into on enums and current mirror behavior for into #23473

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

Merged
merged 1 commit into from
Jul 4, 2025
Merged
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
27 changes: 27 additions & 0 deletions tests/neg/i23400.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import scala.language.experimental.into
import Conversion.into

import scala.deriving.Mirror

object Opaques:
opaque into type MyInto[+A] >: A = A

import Opaques.MyInto

case class Foo(x: Int)
case class Bar(foo: into[Foo])
case class Baz(foo: MyInto[Foo])

given Conversion[Int, Foo] = Foo(_)

into enum Color: // error
case Red, Green

def test =
val barMirror = summon[Mirror.Of[Bar]]
summon[barMirror.MirroredElemTypes =:= (into[Foo] *: EmptyTuple.type)] // error
summon[barMirror.MirroredElemTypes =:= (Foo *: EmptyTuple.type)] // ok

val bazMirror = summon[Mirror.Of[Baz]]
summon[bazMirror.MirroredElemTypes =:= (MyInto[Foo] *: EmptyTuple.type)] // ok
summon[bazMirror.MirroredElemTypes =:= (Foo *: EmptyTuple.type)] // error
Loading