bug icon indicating copy to clipboard operation
bug copied to clipboard

Compiler Crash (NPE) when using defaults in super call and missing implicit

Open lrytz opened this issue 1 year ago • 0 comments

class C(x: Int = 0, y: Int = 0)(implicit blup: String)
class D extends C(y = 1)

The compiler reports the missing implicit and then crashes

/Users/luc/code/scala/scala13/sandbox/T.scala:2: error: could not find implicit value for parameter blup: String
Error occurred in an application involving default arguments.
class D extends C(y = 1)
                ^
error: java.lang.NullPointerException: Cannot invoke "scala.reflect.internal.Symbols$Symbol.isPrimaryConstructor()" because the return value of "scala.reflect.internal.Trees$Tree.symbol()" is null
	at scala.tools.nsc.typechecker.Typers$Typer.analyzeSuperConstructor(Typers.scala:2292)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2482)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:6167)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:6261)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:6339)
	at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$9(Typers.scala:3539)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3539)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2144)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1982)

lrytz avatar Jul 03 '24 10:07 lrytz