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

Backend triggers assertion in assertClassNotArray #461

Closed
smarter opened this issue Apr 3, 2015 · 12 comments
Closed

Backend triggers assertion in assertClassNotArray #461

smarter opened this issue Apr 3, 2015 · 12 comments

Comments

@smarter
Copy link
Member

smarter commented Apr 3, 2015

The following code:

package foo
object Foo {
}                                                                                                                                   

Results in an assertion error:

java.lang.AssertionError: assertion failed: val <none>
        at scala.Predef$.assert(Predef.scala:165)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.assertClassNotArray(BCodeHelpers.scala:214)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.assertClassNotArrayNotPrimitive(BCodeHelpers.scala:219)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.getClassBTypeAndRegisterInnerClass(BCodeHelpers.scala:238)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$JCommonBuilder.getClassBTypeAndRegisterInnerClass(BCodeHelpers.scala:469)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.internalName(BCodeHelpers.scala:210)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$JCommonBuilder.internalName(BCodeHelpers.scala:469)
        at scala.tools.nsc.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:494)
        at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.visit(GenBCode.scala:164)
        at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.run(GenBCode.scala:126)
        at dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:320)
        at dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:289)
        at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:40)
        at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:266)
        at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:264)
        at scala.collection.immutable.List.map(List.scala:273)
        at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:264)
        at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:33)
        at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:50)
        at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:47)
        at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
        at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply$mcV$sp(Run.scala:47)
        at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:42)
        at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:42)
        at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:68)
        at dotty.tools.dotc.Run.compileSources(Run.scala:41)
        at dotty.tools.dotc.Run.compile(Run.scala:32)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:20)
        at dotty.tools.dotc.Main$.doCompile(Main.scala:26)
        at dotty.tools.dotc.Driver.process(Driver.scala:31)
        at dotty.tools.dotc.Driver.main(Driver.scala:40)
        at dotty.tools.dotc.Main.main(Main.scala)
error: Error while emitting packobj.scala
assertion failed: val <none>
one error found

A quick bisection search shows that this started happening when #436 was merged.
Assigned to @DarkDimius .

@smarter smarter changed the title Backend throws assertClassNotArray Backend triggers assertion in assertClassNotArray Apr 3, 2015
@DarkDimius
Copy link
Member

@smarter, I cannot reproduce.
at current master(6c6177c) works for me.

@smarter
Copy link
Member Author

smarter commented Apr 3, 2015

@DarkDimius : Can you try compiling the same fie twice?

@DarkDimius
Copy link
Member

dark@reco ~/workspace/dotty ((6c6177c...)) $ cat tests/pos/empty-foo.scala
package foo
object Bar {
}
> runMain dotty.tools.dotc.Bench #runs 2 ./tests/pos/empty-foo.scala
[info] Running dotty.tools.dotc.Bench #runs 2 ./tests/pos/empty-foo.scala
[info] time elapsed: 687ms
[info] time elapsed: 38ms

Though It doesn't actually pass Ycheck:

> runMain dotty.tools.dotc.Bench #runs 2 ./tests/pos/empty-foo.scala -Ycheck:all
[info] Running dotty.tools.dotc.Bench #runs 2 ./tests/pos/empty-foo.scala -Ycheck:all
[info] checking ./tests/pos/empty-foo.scala after phase frontend
[info] checking ./tests/pos/empty-foo.scala after phase TreeTransform:{firstTransform, synthetics}
[info] checking ./tests/pos/empty-foo.scala after phase superaccessors
[info] checking ./tests/pos/empty-foo.scala after phase pickler
[info] checking ./tests/pos/empty-foo.scala after phase TreeTransform:{refchecks, elimRepeated, normalizeFlags, extmethods, tailrec}
[info] checking ./tests/pos/empty-foo.scala after phase TreeTransform:{patternMatcher, explicitOuter, splitter}
[info] checking ./tests/pos/empty-foo.scala after phase TreeTransform:{LazyVals, seqLiterals, intercepted, literalize, getters, elimByName, resolveSuper}
[info] checking ./tests/pos/empty-foo.scala after phase erasure
[info] checking ./tests/pos/empty-foo.scala after phase TreeTransform:{mixin, memoize, capturedVars, constructors}
[info] checking ./tests/pos/empty-foo.scala after phase TreeTransform:{lambdaLift, flatten, restoreScopes}
[info] exception while typing new foo.Bar$() of class class dotty.tools.dotc.ast.Trees$Apply # 91
[info] exception while typing final lazy module val Bar: foo.Bar$ = new foo.Bar$() of class class dotty.tools.dotc.ast.Trees$ValDef # 92
[info] exception while typing package foo {
[info]   final lazy module val Bar: foo.Bar$ = new foo.Bar$()
[info]   final module class Bar$ extends Object { this: <notype> =>
[info]     def <init>(): foo.Bar$ = {
[info]       Bar$.super()
[info]       ()
[info]     }
[info]   }
[info] } of class class dotty.tools.dotc.ast.Trees$PackageDef # 117
[info] *** error while checking after phase restoreScopes ***
[error] Exception in thread "main" java.lang.AssertionError: assertion failed: non member selection of constructor Bar$ in object Bar$ from foo.Bar$
[error]     at scala.Predef$.assert(Predef.scala:165)
[error]     at dotty.tools.dotc.transform.FirstTransform.checkPostCondition(FirstTransform.scala:43)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker$$anonfun$typedUnadapted$1.apply(TreeChecker.scala:183)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker$$anonfun$typedUnadapted$1.apply(TreeChecker.scala:183)
[error]     at scala.collection.immutable.List.foreach(List.scala:381)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:183)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1086)
[error]     at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
[error]     at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
[error]     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1086)
[error]     at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1125)
[error]     at dotty.tools.dotc.typer.Applications$$anonfun$realApply$1$1.apply(Applications.scala:516)
[error]     at dotty.tools.dotc.typer.Applications$$anonfun$realApply$1$1.apply(Applications.scala:512)
[error]     at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
[error]     at dotty.tools.dotc.typer.Applications$class.realApply$1(Applications.scala:512)
[error]     at dotty.tools.dotc.typer.Applications$class.typedApply(Applications.scala:578)
[error]     at dotty.tools.dotc.typer.Typer.typedApply(Typer.scala:58)
[error]     at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1038)
[error]     at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1078)
[error]     at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:93)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:166)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1086)
[error]     at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
[error]     at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
[error]     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1086)
[error]     at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1125)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typedValDef$1.apply(Typer.scala:880)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typedValDef$1.apply(Typer.scala:874)
[error]     at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
[error]     at dotty.tools.dotc.typer.Typer.typedValDef(Typer.scala:874)
[error]     at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1023)
[error]     at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1076)
[error]     at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:93)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:166)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1086)
[error]     at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
[error]     at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
[error]     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1086)
[error]     at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1110)
[error]     at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1121)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker.typedStats(TreeChecker.scala:275)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:969)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:960)
[error]     at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
[error]     at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:960)
[error]     at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1066)
[error]     at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1078)
[error]     at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:93)
[error]     at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:166)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1088)
[error]     at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1086)
[error]     at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
[error]     at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
[error]     at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1086)
[error]     at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1125)
[error]     at dotty.tools.dotc.transform.TreeChecker.check(TreeChecker.scala:100)
[error]     at dotty.tools.dotc.transform.TreeChecker.run(TreeChecker.scala:78)
[error]     at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:266)
[error]     at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:264)
[error]     at scala.collection.immutable.List.map(List.scala:273)
[error]     at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:264)
[error]     at dotty.tools.dotc.transform.TreeChecker.runOn(TreeChecker.scala:38)
[error]     at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:50)
[error]     at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:47)
[error]     at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
[error]     at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
[error]     at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply$mcV$sp(Run.scala:47)
[error]     at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:42)
[error]     at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:42)
[error]     at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:68)
[error]     at dotty.tools.dotc.Run.compileSources(Run.scala:41)
[error]     at dotty.tools.dotc.Run.compile(Run.scala:32)
[error]     at dotty.tools.dotc.Driver.doCompile(Driver.scala:20)
[error]     at dotty.tools.dotc.Bench$.dotty$tools$dotc$Bench$$super$doCompile(Bench.scala:38)
[error]     at dotty.tools.dotc.Bench$$anonfun$doCompile$1.apply(Bench.scala:38)
[error]     at dotty.tools.dotc.Bench$$anonfun$doCompile$1.apply(Bench.scala:36)
[error]     at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
[error]     at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
[error]     at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
[error]     at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
[error]     at scala.collection.immutable.Range.foreach(Range.scala:166)
[error]     at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:142)
[error]     at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:104)
[error]     at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:136)
[error]     at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:104)
[error]     at dotty.tools.dotc.Bench$.ntimes(Bench.scala:30)
[error]     at dotty.tools.dotc.Bench$.doCompile(Bench.scala:36)
[error]     at dotty.tools.dotc.Driver.process(Driver.scala:31)
[error]     at dotty.tools.dotc.Bench$.dotty$tools$dotc$Bench$$super$process(Bench.scala:53)
[error]     at dotty.tools.dotc.Bench$$anonfun$process$1.apply(Bench.scala:53)
[error]     at dotty.tools.dotc.Bench$$anonfun$process$1.apply(Bench.scala:53)
[error]     at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
[error]     at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
[error]     at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
[error]     at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
[error]     at scala.collection.immutable.Range.foreach(Range.scala:166)
[error]     at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:142)
[error]     at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:104)
[error]     at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:136)
[error]     at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:104)
[error]     at dotty.tools.dotc.Bench$.ntimes(Bench.scala:30)
[error]     at dotty.tools.dotc.Bench$.process(Bench.scala:53)
[error]     at dotty.tools.dotc.Driver.main(Driver.scala:40)
[error]     at dotty.tools.dotc.Bench.main(Bench.scala)
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last dotty/compile:runMain for the full output.
[error] (dotty/compile:runMain) Nonzero exit code returned from runner: 1
[error] Total time: 1 s, completed Apr 4, 2015 2:02:27 AM

@DarkDimius
Copy link
Member

I guess I know the issue.
Wait for PR.

@smarter
Copy link
Member Author

smarter commented Apr 4, 2015

OK, this appears to be very tricky to reproduce, here's a script that should help:

#!/bin/sh

set -x
mv ff ff.bak
mkdir newDir
cd newDir
echo "package ff\nobject Foo {}" > po.scala
cd ..
sbt "run ./newDir/po.scala"
sbt "run ./newDir/po.scala"

Put this in a file called bug.sh, then:

% sh bug.sh
+ mv ff ff.bak
+ mkdir newDir
mkdir: cannot create directory ‘newDir’: File exists
+ cd newDir
+ echo package ff\nobject Foo {}
+ cd ..
+ sbt run ./newDir/po.scala
[info] Loading global plugins from /home/smarter/.sbt/0.13/plugins
[info] Loading project definition from /home/smarter/opt/dotty/project
[info] Set current project to dotty (in build file:/home/smarter/opt/dotty/)
[info] Running dotty.tools.dotc.Main ./newDir/po.scala
[success] Total time: 3 s, completed Apr 4, 2015 2:25:20 AM
+ sbt run ./newDir/po.scala
[info] Loading global plugins from /home/smarter/.sbt/0.13/plugins
[info] Loading project definition from /home/smarter/opt/dotty/project
[info] Set current project to dotty (in build file:/home/smarter/opt/dotty/)
[info] Running dotty.tools.dotc.Main ./newDir/po.scala
[error] java.lang.AssertionError: assertion failed: val <none>
[error]         at scala.Predef$.assert(Predef.scala:165)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.assertClassNotArray(BCodeHelpers.scala:214)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.assertClassNotArrayNotPrimitive(BCodeHelpers.scala:219)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.getClassBTypeAndRegisterInnerClass(BCodeHelpers.scala:238)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$JCommonBuilder.getClassBTypeAndRegisterInnerClass(BCodeHelpers.scala:469)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$BCInnerClassGen$class.internalName(BCodeHelpers.scala:210)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$JCommonBuilder.internalName(BCodeHelpers.scala:469)
[error]         at scala.tools.nsc.backend.jvm.BCodeHelpers$JMirrorBuilder.genMirrorClass(BCodeHelpers.scala:494)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.visit(GenBCode.scala:164)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline$Worker1.run(GenBCode.scala:126)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline.buildAndSendToDisk(GenBCode.scala:320)
[error]         at dotty.tools.backend.jvm.GenBCodePipeline.run(GenBCode.scala:289)
[error]         at dotty.tools.backend.jvm.GenBCode.run(GenBCode.scala:40)
[error]         at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:266)
[error]         at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:264)
[error]         at scala.collection.immutable.List.map(List.scala:273)
[error]         at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:264)
[error]         at dotty.tools.backend.jvm.GenBCode.runOn(GenBCode.scala:33)
[error]         at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:50)
[error]         at dotty.tools.dotc.Run$$anonfun$compileSources$1$$anonfun$apply$mcV$sp$3.apply(Run.scala:47)
[error]         at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
[error]         at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
[error]         at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply$mcV$sp(Run.scala:47)
[error]         at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:42)
[error]         at dotty.tools.dotc.Run$$anonfun$compileSources$1.apply(Run.scala:42)
[error]         at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:68)
[error]         at dotty.tools.dotc.Run.compileSources(Run.scala:41)
[error]         at dotty.tools.dotc.Run.compile(Run.scala:32)
[error]         at dotty.tools.dotc.Driver.doCompile(Driver.scala:20)
[error]         at dotty.tools.dotc.Main$.doCompile(Main.scala:26)
[error]         at dotty.tools.dotc.Driver.process(Driver.scala:31)
[error]         at dotty.tools.dotc.Driver.main(Driver.scala:40)
[error]         at dotty.tools.dotc.Main.main(Main.scala)
[error] error: Error while emitting po.scala
[error] assertion failed: val <none>
[error] one error found
java.lang.RuntimeException: Nonzero exit code returned from runner: 1
        at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last dotty/compile:run for the full output.
[error] (dotty/compile:run) Nonzero exit code returned from runner: 1
[error] Total time: 2 s, completed Apr 4, 2015 2:25:27 AM

@DarkDimius
Copy link
Member

Was able to reproduce, after running the script in loop for around 20 times.

The problem that causes backend to go wild:
in case compiled jars are there, in some cases, module class Foo$ that is currently being compiled from tree, gets a JavaDefined flag. This should never happen.

@smarter
Copy link
Member Author

smarter commented Apr 4, 2015

Yes, I'm not crazy then :).

@DarkDimius
Copy link
Member

That's some kind of bug in RestoreScopes. It:

  1. in invalidateUndefinedCompanions artificially forges name of class Foo(not Foo$)
  2. pkg.info.decl("Foo").asSymDenotation forces loading of Foo.class from classpath(that was generated just to emit static forwarders).
  3. reading Foo.class from classpath defines pair of java-defined(as they do not have scalaSig annotation) classes Foo and Foo$
  4. ignores that those classes are currently being compiled, treats them as being currently valid. I guess there's some side effect that actually makes classes that are read from bytecode override the ones that are currently being compiled somewhere. By the time of backend, tree has already wrong symbol.

It could have to do with #462.

@odersky, AFAIK you have made some fixes to RestoreScopes. Could you have a look?

@DarkDimius
Copy link
Member

Why this doesn't create a problem for travis: current test infrastructure emits classfile outputs in ./out/, which is not included in classpath.
They way you run it, you've included files of previous run on classpath.

@DarkDimius
Copy link
Member

@odersky #464 showcases the problem in easier to reproduce way.

@DarkDimius
Copy link
Member

@smarter, after latest fixes for stale symbols and restoreScopes cannot reproduce anymore.
Will you try?

@smarter
Copy link
Member Author

smarter commented Apr 12, 2015

I can't reproduce anymore either, I guess whatever fixed #462 fixed this.

@smarter smarter closed this as completed Apr 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants