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

scala 3 compiler crashes with a script consisting of an AutoSession reference #1738

Open
philwalk opened this issue Oct 9, 2022 · 0 comments
Labels

Comments

@philwalk
Copy link

philwalk commented Oct 9, 2022

After I filed this, I then filed an issue at scala 3 with more detailed information.

My system is:

java version "11.0.12" 2021-07-20 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.12+8-LTS-237)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.12+8-LTS-237, mixed mode)

  • Scala code runner version 3.2.0 -- Copyright 2002-2022, LAMP/EPFL

    "org.scalikejdbc" %% "scalikejdbc" % "4.0.0",
    "org.scalikejdbc" %% "scalikejdbc-core" % "4.0.0",
    "org.scalikejdbc" %% "scalikejdbc-interpolation" % "4.0.0",

Doesn't seem to matter, either of these bash SHELL environments show the problem:

  • MINGW64_NT-10.0-19044 d5 3.3.6-341.x86_64 2022-09-20 22:07 UTC x86_64 Msys
  • CYGWIN_NT-10.0-19044 d5 3.3.6-341.x86_64 2022-09-05 11:15 UTC x86_64 Cygwin

The following Minimally Reproducible Example triggers the problem:

  import scalikejdbc._
  implicit val session: AutoSession.type = {
    AutoSession // ad-hoc session provider
  }
  def main(args: Array[String]): Unit = ()
  • Store it to a file named autoSessionBug.sc
  • Place two libraries in your classpath:
    lib/scalikejdbc-core_3-4.0.0.jar
    lib/scalikejdbc-interpolation_3-4.0.0.jar
  • Issue either of thses command lines:

bash shell command line:

/opt/scala3/bin/scala -cp 'lib/scalikejdbc-core_3-4.0.0.jar;lib/scalikejdbc-interpolation_3-4.0.0.jar' autoSessionBug.sc

CMD.EXE session command line:

\opt\scala3\bin\scala.bat -cp "lib/scalikejdbc-core_3-4.0.0.jar;lib/scalikejdbc-interpolation_3-4.0.0.jar" autoSessionBug.sc

Here's what I get:

Error while emitting tkholdingsInfo.sc
exception occurred while compiling C:\opt\ue\jsrc\tkholdingsInfo.sc
java.lang.AssertionError: assertion failed while compiling C:\opt\ue\jsrc\tkholdingsInfo.sc
Exception in thread "main" java.lang.AssertionError: assertion failed
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
        at dotty.tools.dotc.core.Types$MethodType.(Types.scala:3745)
        at dotty.tools.dotc.core.Types$CachedMethodType.(Types.scala:3765)
        at dotty.tools.dotc.core.Types$MethodTypeCompanion.apply(Types.scala:3836)
        at dotty.tools.dotc.core.Types$MethodTypeCompanion.apply(Types.scala:3835)
        at dotty.tools.dotc.core.Types$LambdaTypeCompanion.apply(Types.scala:3777)
        at dotty.tools.dotc.core.TypeErasure.eraseInfo(TypeErasure.scala:740)
        at dotty.tools.dotc.core.TypeErasure$.transformInfo(TypeErasure.scala:244)
        at dotty.tools.dotc.transform.Erasure.transform(Erasure.scala:97)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:833)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:120)
        at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:114)
        at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:107)
        at dotty.tools.dotc.core.Symbols$.toDenot(Symbols.scala:497)
        at dotty.tools.dotc.transform.Mixin.needsTraitSetter(Mixin.scala:170)
        at dotty.tools.dotc.transform.Mixin.transformSym$$anonfun$1(Mixin.scala:149)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at dotty.tools.dotc.core.Scopes$Scope.foreach(Scopes.scala:93)
        at dotty.tools.dotc.transform.Mixin.transformSym(Mixin.scala:153)
        at dotty.tools.dotc.core.DenotTransformers$SymTransformer.transform(DenotTransformers.scala:70)
        at dotty.tools.dotc.core.DenotTransformers$SymTransformer.transform$(DenotTransformers.scala:65)
        at dotty.tools.dotc.transform.Mixin.transform(Mixin.scala:109)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:833)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:853)
        at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:882)
        at dotty.tools.dotc.core.Symbols$Symbol.recomputeDenot(Symbols.scala:120)
        at dotty.tools.dotc.core.Symbols$Symbol.computeDenot(Symbols.scala:114)
        at dotty.tools.dotc.core.Symbols$Symbol.denot(Symbols.scala:107)
        at dotty.tools.dotc.core.Symbols$ClassSymbol.classDenot(Symbols.scala:460)
        at dotty.tools.dotc.core.Symbols$.toClassDenot(Symbols.scala:500)
        at dotty.tools.backend.jvm.BTypesFromSymbols.$anonfun$1(BTypesFromSymbols.scala:141)
        at scala.collection.Iterator$$anon$10.nextCur(Iterator.scala:587)
        at scala.collection.Iterator$$anon$10.hasNext(Iterator.scala:601)
        at scala.collection.mutable.Growable.addAll(Growable.scala:61)
        at scala.collection.mutable.Growable.addAll$(Growable.scala:57)
        at scala.collection.immutable.SetBuilderImpl.addAll(Set.scala:396)
        at scala.collection.immutable.Set$.from(Set.scala:353)
        at scala.collection.IterableOnceOps.toSet(IterableOnce.scala:1258)
        at scala.collection.IterableOnceOps.toSet$(IterableOnce.scala:1258)
        at scala.collection.AbstractIterator.toSet(Iterator.scala:1293)
        at dotty.tools.backend.jvm.BTypesFromSymbols.superInterfaces$1(BTypesFromSymbols.scala:141)
        at dotty.tools.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:149)
        at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol$$anonfun$1(BTypesFromSymbols.scala:91)
        at scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436)
        at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:92)
        at dotty.tools.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:132)
        at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol$$anonfun$1(BTypesFromSymbols.scala:91)
        at scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436)
        at dotty.tools.backend.jvm.BTypesFromSymbols.classBTypeFromSymbol(BTypesFromSymbols.scala:92)
        at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.getClassBType(BCodeHelpers.scala:261)
        at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.getClassBType$(BCodeHelpers.scala:213)
        at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.getClassBType(BCodeHelpers.scala:654)
        at dotty.tools.backend.jvm.BCodeHelpers.primitiveOrClassToBType$1$$anonfun$1(BCodeHelpers.scala:798)
        at scala.collection.immutable.HashMap.getOrElse(HashMap.scala:683)
        at dotty.tools.backend.jvm.BCodeHelpers.primitiveOrClassToBType$1(BCodeHelpers.scala:798)
        at dotty.tools.backend.jvm.BCodeHelpers.dotty$tools$backend$jvm$BCodeHelpers$$typeToTypeKind(BCodeHelpers.scala:817)
        at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind(BCodeHelpers.scala:285)
        at dotty.tools.backend.jvm.BCodeHelpers$BCInnerClassGen.toTypeKind$(BCodeHelpers.scala:213)
        at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.toTypeKind(BCodeHelpers.scala:654)
        at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarder(BCodeHelpers.scala:518)
        at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders$$anonfun$3(BCodeHelpers.scala:594)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders(BCodeHelpers.scala:596)
        at dotty.tools.backend.jvm.BCodeHelpers$BCForwardersGen.addForwarders$(BCodeHelpers.scala:490)
        at dotty.tools.backend.jvm.BCodeHelpers$JCommonBuilder.addForwarders(BCodeHelpers.scala:654)
        at dotty.tools.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:701)
        at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.visit(GenBCode.scala:257)
        at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.run(GenBCode.scala:231)
        at dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:598)
        at dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:564)
        at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:69)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:311)
        at scala.collection.immutable.List.map(List.scala:246)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:312)
        at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:77)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:234)
        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:1328)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:245)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:253)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:262)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:262)
        at dotty.tools.dotc.Run.compileSources(Run.scala:186)
        at dotty.tools.dotc.Run.compile(Run.scala:170)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
        at dotty.tools.scripting.ScriptingDriver.compileAndRun(ScriptingDriver.scala:22)
        at dotty.tools.scripting.Main$.main(Main.scala:45)
        at dotty.tools.MainGenericRunner$.run$1(MainGenericRunner.scala:249)
        at dotty.tools.MainGenericRunner$.main(MainGenericRunner.scala:268)
        at dotty.tools.MainGenericRunner.main(MainGenericRunner.scala)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants