Skip to content

Compiler crashes on private constructor with default argument when running with -Ycheck:all #23477

Open
@PhoenixmitX

Description

@PhoenixmitX

Compiler version

3.7.1

Minimized code

class Test private (a: Int, b: Int = 1):
	def this() =
		this(1)

Output (click arrow to expand)

scalac Crash.scala -Ycheck:all

checking Crash.scala after phase typer
checking Crash.scala after phase inlinedPositions
checking Crash.scala after phase posttyper
checking Crash.scala after phase unrollDefs
checking Crash.scala after phase pickler
checking Crash.scala after phase inlining
checking Crash.scala after phase postInlining
checking Crash.scala after phase staging
checking Crash.scala after phase splicing
checking Crash.scala after phase pickleQuotes
checking Crash.scala after phase MegaPhase{crossVersionChecks, firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs, elimRepeated, refchecks, dropForMap}
checking Crash.scala after phase MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher}
checking Crash.scala after phase MegaPhase{elimOpaque, explicitOuter, explicitSelf, interpolators, dropBreaks}
checking Crash.scala after phase MegaPhase{pruneErasedDefs, uninitialized, inlinePatterns, vcInlineMethods, seqLiterals, intercepted, getters, specializeFunctions, specializeTuples, collectNullableFields, elimOuterSelect, resolveSuper, functionXXLForwarders, paramForwarding, genericTuples, letOverApply, arrayConstructors}
checking Crash.scala after phase erasure
checking Crash.scala after phase MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, etaReduce, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
checking Crash.scala after phase constructors
checking Crash.scala after phase MegaPhase{lambdaLift, elimStaticThis, countOuterAccesses}
checking Crash.scala after phase MegaPhase{dropOuterAccessors, dropParentRefinements, checkNoSuperThis, flatten, transformWildcards, moveStatic, expandPrivate, restoreScopes, selectStatic, Collect entry points, collectSuperCalls, repeatableAnnotations}
*** error while checking Crash.scala after phase MegaPhase{dropOuterAccessors, dropParentRefinements, checkNoSuperThis, flatten, transformWildcards, moveStatic, expandPrivate, restoreScopes, selectStatic, Collect entry points, collectSuperCalls, repeatableAnnotations} ***

  unhandled exception while running Ycheck on Crash.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.


     while compiling: Crash.scala
        during phase: Ycheck
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.16
    compiler version: version 3.7.1
            settings: -Ycheck List(all)

Exception in thread "main" java.lang.AssertionError: assertion failed: Crash[ModuleClass][Qualified $$ <init>][DefaultGetter 1] name is invalid on jvm
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef$$anonfun$1(TreeChecker.scala:639)
        at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:278)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:651)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3544)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3222)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedClassDef(TreeChecker.scala:618)
        at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3550)
        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3554)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3649)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3754)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3800)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:691)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3355)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedPackageDef(TreeChecker.scala:717)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3596)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3650)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:434)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3727)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3732)
        at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:416)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3843)
        at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:131)
        at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:111)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:383)
        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:334)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:376)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:368)
        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:1324)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:361)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$2(Run.scala:408)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1$$anonfun$adapted$1(Run.scala:408)
        at scala.Function0.apply$mcV$sp(Function0.scala:42)
        at dotty.tools.dotc.Run.showProgress(Run.scala:470)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:408)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:420)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:420)
        at dotty.tools.dotc.Run.compileSources(Run.scala:307)
        at dotty.tools.dotc.Run.compile(Run.scala:292)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.dotc.Driver.process(Driver.scala:201)
        at dotty.tools.dotc.Driver.process(Driver.scala:169)
        at dotty.tools.dotc.Driver.process(Driver.scala:181)
        at dotty.tools.dotc.Driver.main(Driver.scala:211)
        at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
        at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
        at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions