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

crash when summon Mirror for case class with private ctor compiled by 2.13 #14432

Closed
bishabosha opened this issue Feb 8, 2022 · 0 comments · Fixed by #15008
Closed

crash when summon Mirror for case class with private ctor compiled by 2.13 #14432

bishabosha opened this issue Feb 8, 2022 · 0 comments · Fixed by #15008

Comments

@bishabosha
Copy link
Member

Compiler version

3.1.1

Minimized code

// scalac -version ==> 2.13.6
case class Foo private (i: Int)
// scalac -version ==> 3.1.1
@main def Test =
  summon[deriving.Mirror.Of[Foo]]

Output (click arrow to expand)

java.lang.AssertionError: assertion failed: private constructor Foo in class Foo in <no file> accessed from method fromProduct in baz.scala while compiling baz.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: private constructor Foo in class Foo in <no file> accessed from method fromProduct in baz.scala
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.transform.ExpandPrivate.ensurePrivateAccessible(ExpandPrivate.scala:87)
	at dotty.tools.dotc.transform.ExpandPrivate.transformSelect(ExpandPrivate.scala:97)
	at dotty.tools.dotc.transform.ExpandPrivate.transformSelect(ExpandPrivate.scala:96)
	at dotty.tools.dotc.transform.MegaPhase.goSelect(MegaPhase.scala:599)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:229)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:279)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:249)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:252)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:437)
	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:362)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:437)
	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:362)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:427)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:437)
	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.recur$1(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:382)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:385)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:429)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:448)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:460)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:308)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:309)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:261)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:272)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:280)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:289)
	at dotty.tools.dotc.Run.compileSources(Run.scala:222)
	at dotty.tools.dotc.Run.compile(Run.scala:206)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:39)
	at dotty.tools.dotc.Driver.process(Driver.scala:199)
	at dotty.tools.dotc.Driver.process(Driver.scala:167)
	at dotty.tools.dotc.Driver.process(Driver.scala:179)
	at dotty.tools.dotc.Driver.main(Driver.scala:209)
	at dotty.tools.dotc.Main.main(Main.scala)
@bishabosha bishabosha added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label area:typeclass-derivation and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 8, 2022
@bishabosha bishabosha changed the title crash when summon Mirror for case class with private ctor compiled by scala 2 crash when summon Mirror for case class with private ctor compiled by 2.13 Feb 8, 2022
bishabosha added a commit to dotty-staging/dotty that referenced this issue Apr 22, 2022
@bishabosha bishabosha self-assigned this Apr 22, 2022
bishabosha added a commit to dotty-staging/dotty that referenced this issue May 5, 2022
bishabosha added a commit to dotty-staging/dotty that referenced this issue May 5, 2022
bishabosha added a commit to dotty-staging/dotty that referenced this issue May 5, 2022
bishabosha added a commit to dotty-staging/dotty that referenced this issue May 5, 2022
bishabosha added a commit to dotty-staging/dotty that referenced this issue May 6, 2022
bishabosha added a commit that referenced this issue May 6, 2022
fix #14432: check if scala 2 case class is accessible
bishabosha added a commit to dotty-staging/dotty that referenced this issue Oct 18, 2022
@Kordyjan Kordyjan added this to the 3.2.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants