How to find the source file that causes the Scalac compiler to crash

I am engaged in the modernization of a large project to 2.10.4 to 2.11.4. Did I get a compiler crash anyway to display the name of the source file causing the crash? I can get the full track with "last everitt / compile: compile"

I am going to return to erasing large chunks of the project into a binary search for the cause of the failure.

Here is the btw trace:

java.lang.NullPointerException at scala.tools.nsc.typechecker.NamesDefaults$class.baseFunBlock$1(NamesDefaults.scala:130) at scala.tools.nsc.typechecker.NamesDefaults$class.transformNamedApplication(NamesDefaults.scala:375) at scala.tools.nsc.Global$$anon$1.transformNamedApplication(Global.scala:450) at scala.tools.nsc.typechecker.NamesDefaults$class.transformNamedApplication(NamesDefaults.scala:326) at scala.tools.nsc.Global$$anon$1.transformNamedApplication(Global.scala:450) at scala.tools.nsc.typechecker.Typers$Typer.tryNamesDefaults$1(Typers.scala:3298) at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3367) at scala.tools.nsc.typechecker.Typers$Typer.tryNamesDefaults$1(Typers.scala:3353) at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3367) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$tryTypedApply$1$1.apply(Typers.scala:4404) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$tryTypedApply$1$1.apply(Typers.scala:4404) at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:689) at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4404) at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4449) at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4484) at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5242) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:3094) at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$class.typedArgWithFormal$1(PatternTypers.scala:112) at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$$anonfun$2.apply(PatternTypers.scala:115) at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$$anonfun$2.apply(PatternTypers.scala:115) at scala.runtime.Tuple2Zipped$$anonfun$map$extension$1.apply(Tuple2Zipped.scala:42) at scala.runtime.Tuple2Zipped$$anonfun$map$extension$1.apply(Tuple2Zipped.scala:40) at scala.collection.immutable.List.foreach(List.scala:381) at scala.runtime.Tuple2Zipped$.map$extension(Tuple2Zipped.scala:40) at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$class.typedArgsForFormals(PatternTypers.scala:115) at scala.tools.nsc.typechecker.Typers$Typer.typedArgsForFormals(Typers.scala:107) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$handleMonomorphicCall$1(Typers.scala:3384) at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3409) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$tryTypedApply$1$1.apply(Typers.scala:4404) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$tryTypedApply$1$1.apply(Typers.scala:4404) at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:676) at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4404) at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4449) at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4484) at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5242) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.typedAssign$1(Typers.scala:4136) at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5223) at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5252) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2341) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedOutsidePatternMode$1$1.apply(Typers.scala:5217) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedOutsidePatternMode$1$1.apply(Typers.scala:5217) at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5216) at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5252) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5259) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5504) at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2167) at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5207) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5258) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5351) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2977) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:3081) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:3081) at scala.collection.immutable.List.loop$1(List.scala:172) at scala.collection.immutable.List.mapConserve(List.scala:188) at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3081) at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1880) at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1721) at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5208) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5258) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5351) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:2977) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:3081) at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$60.apply(Typers.scala:3081) at scala.collection.immutable.List.loop$1(List.scala:172) at scala.collection.immutable.List.mapConserve(List.scala:188) at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3081) at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4918) at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5211) at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5258) at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5295) at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5322) at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5269) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5273) at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5347) at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102) at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:428) at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:419) at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:428) at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:94) at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:93) at scala.collection.Iterator$class.foreach(Iterator.scala:743) at scala.collection.AbstractIterator.foreach(Iterator.scala:1195) at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93) at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1338) at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1325) at scala.tools.nsc.Global$Run.compileSources(Global.scala:1320) at scala.tools.nsc.Global$Run.compile(Global.scala:1418) at xsbt.CachedCompiler0.run(CompilerInterface.scala:116) at xsbt.CachedCompiler0.run(CompilerInterface.scala:95) at xsbt.CompilerInterface.run(CompilerInterface.scala:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101) at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47) at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:97) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:97) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:97) at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:162) at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:96) at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:139) at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36) at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:39) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38) at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:66) at sbt.inc.Incremental$.compile(Incremental.scala:38) at sbt.inc.IncrementalCompile$.apply(Compile.scala:26) at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:153) at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70) at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45) at sbt.Compiler$.apply(Compiler.scala:74) at sbt.Compiler$.apply(Compiler.scala:65) at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:777) at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:769) at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:769) at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47) at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40) at sbt.std.Transform$$anon$4.work(System.scala:63) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226) at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17) at sbt.Execute.work(Execute.scala:235) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226) at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159) at sbt.CompletionService$$anon$2.call(CompletionService.scala:28) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 

Edit: after erasing and commenting on a large number of files, I simplified this:

 case class A(x: String) case class B(a: A, y: String) class C(var b: B) { def a = ba b.copy(a = a.copy()) } 

Edit2: Best of all, I can say that there is no good choice for this, I'm going to move on, I filed an error message for this problem ( SI-9035 ). If anyone knows an option / way to do this, write an answer! In the meantime, I will just continue to use the method that I have used since version 2.6: delete files and comment out lines until I get to the minimum example and publish an error report. Thanks for the ideas.

+8
scala sbt scalac
source share
1 answer

In this case, -verbose indicates that this is done with the packageobjects phase, and -Xshow-phases tells typer following. (Parser reports that he was just taking it apart.)

-Ytyper-debug emits numbered output, but shows what happens during type checking.

This information may at least help your next search or a larger question.

Something like:

 | | |-- b.copy(a = a.copy()) EXPRmode (site: method f in C) | | | |-- b.copy BYVALmode-EXPRmode-FUNmode-POLYmode (silent: method f in C) | | | | |-- b EXPRmode-POLYmode-QUALmode (silent: method f in C) | | | | | \-> nope.B | | | | \-> (a: nope.A, y: String)nope.B | | | |-- qual$1 EXPRmode-POLYmode-QUALmode (silent: method f in C) | | | | \-> qual$1.type (with underlying type nope.B) | | | |-- (a: nope.A, y: String)nope.B EXPRmode-FUNmode-POLYmode-TAPPmode (silent: method f in C) | | | | \-> (a: nope.A, y: String)nope.B | | | |-- a = a.copy() : pt=nope.A EXPRmode (silent: method f in C) | | | | |-- a EXPRmode-LHSmode (silent: method f in C) | | | | | \-> nope.A | | | | |-- C.this.a_$eq(a.copy()) : pt=nope.A EXPRmode (silent: method f in C) | | | | | |-- C.this.a_$eq BYVALmode-EXPRmode-FUNmode-POLYmode (silent: method f in C) | | | | | | \-> <error> | | | | | |-- a.copy() : pt=<error> EXPRmode (silent: method f in C) | | | | | | |-- a.copy BYVALmode-EXPRmode-FUNmode-POLYmode (silent: method f in C) | | | | | | | |-- a EXPRmode-POLYmode-QUALmode (silent: method f in C) | | | | | | | | \-> nope.A | | | | | | | \-> (x: String)nope.A | | | | | | |-- qual$2 EXPRmode-POLYmode-QUALmode (silent: method f in C) | | | | | | | \-> qual$2.type (with underlying type nope.A) | | | | | | |-- (x: String)nope.A EXPRmode-FUNmode-POLYmode-TAPPmode (silent: method f in C) | | | | | | | \-> (x: String)nope.A | | | | | | \-> nope.A | | | | | \-> <error> | | | | \-> <error> error: java.lang.NullPointerException at scala.tools.nsc.typechecker.Typers$Typer.noExpectedType$1(Typers.scala:3464) 

may lead to the search for any errors with "named arguments", such as this open error ; not your crasher, but similar players.

When the compiler "cancels", it offers more useful information than when it crashes.

+2
source share

All Articles