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

Bad parameter reference at tryCatchPatterns when compiling collections strawman #3775

Closed
szeiger opened this issue Jan 8, 2018 · 1 comment

Comments

@szeiger
Copy link
Contributor

szeiger commented Jan 8, 2018

When compiling scala/collection-strawman@2e14651 with sbt ++0.6.0-bin-20171212-9de3905-NIGHTLY compile I get the following error:

assertion failure for this.T <:< (): IntMapIterator.this.T, frozen = true
[info] exception occurred while compiling /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/ArrayOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/BitSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/BufferedIterator.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/BuildFrom.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/DefaultMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Factory.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Hashing.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/IndexedSeq.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Iterable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/IterableOnce.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Iterator.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/JavaConverters.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/LazyZipOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/LinearSeq.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Map.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Seq.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Set.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/SortedMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/SortedOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/SortedSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/StrictOptimizedIterableOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/StrictOptimizedSeqOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/StrictOptimizedSortedSetOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/StringOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/Traversable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/View.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/WithFilter.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/concurrent/Map.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/concurrent/TrieMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/AsJavaConverters.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/AsScalaConverters.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/DecorateAsJava.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/DecorateAsScala.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/Decorators.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/WrapAsJava.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/WrapAsScala.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/convert/Wrappers.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/generic/BitOperations.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/generic/IsIterableLike.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/BitSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/HashMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/HashSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/ImmutableArray.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/IntMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/Iterable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/LazyList.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/List.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/ListMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/ListSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/LongMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/Map.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/NumericRange.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/Range.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/RedBlackTree.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/Seq.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/Set.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/SortedMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/SortedSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/StrictOptimizedSeqOps.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/TreeMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/TreeSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/TrieIterator.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/Vector.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/immutable/package.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/AnyRefMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/ArrayBuffer.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/BitSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Buffer.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Builder.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/FlatHashTable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Growable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/GrowableBuilder.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/HashMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/HashSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/HashTable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/ImmutableBuilder.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Iterable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/LinkedHashMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/LinkedHashSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/ListBuffer.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/LongMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Map.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/RedBlackTree.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/ReusableBuilder.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Seq.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Set.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/Shrinkable.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/SortedMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/SortedSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/TreeMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/TreeSet.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/mutable/WeakHashMap.scala, /Users/szeiger/code/scala/collection-strawman/collections/src/main/scala/strawman/collection/package.scala
java.lang.AssertionError: assertion failed: bad parameter reference this.T at tryCatchPatterns
the parameter is type T in class IntMapIterator but the prefix strawman.collection.immutable.IntMapIterator(this)
does not define any corresponding arguments.
       	at dotty.DottyPredef$.assertFail(DottyPredef.scala:39)
       	at dotty.tools.dotc.core.Types$NamedType.argDenot(Types.scala:1747)
       	at dotty.tools.dotc.core.Types$NamedType.fromDesignator$1(Types.scala:1675)
       	at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:1696)
       	at dotty.tools.dotc.core.Types$NamedType.denotAt(Types.scala:1647)
       	at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:1636)
       	at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:1630)
       	at dotty.tools.dotc.core.TypeComparer.secondTry(TypeComparer.scala:282)
       	at dotty.tools.dotc.core.TypeComparer.firstTry(TypeComparer.scala:277)
       	at dotty.tools.dotc.core.TypeComparer.op$7(TypeComparer.scala:118)
       	at dotty.tools.dotc.core.TypeComparer.op$1(TypeComparer.scala:32)
       	at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:109)
       	at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:161)
       	at dotty.tools.dotc.core.Types$Type.op$17(Types.scala:771)
       	at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:770)
       	at dotty.tools.dotc.core.Types$Type.overrides(Types.scala:807)
       	at dotty.tools.dotc.typer.RefChecks$.compatibleTypes$4(RefChecks.scala:272)
       	at dotty.tools.dotc.typer.RefChecks$.checkOverride$1(RefChecks.scala:380)
       	at dotty.tools.dotc.typer.RefChecks$.dotty$tools$dotc$typer$RefChecks$$$checkAllOverrides(RefChecks.scala:401)
       	at dotty.tools.dotc.typer.RefChecks.transformTemplate(RefChecks.scala:846)
       	at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:906)
       	at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:907)
       	at dotty.tools.dotc.transform.MegaPhase.goTemplate(MegaPhase.scala:907)
       	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:318)
       	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:365)
       	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:234)
       	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:364)
       	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:373)
       	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:378)
       	at scala.collection.immutable.List.mapConserve(List.scala:176)
       	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:378)
       	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:334)
       	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:337)
       	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:365)
       	at dotty.tools.dotc.transform.MegaPhase.transformStat$2(MegaPhase.scala:375)
       	at dotty.tools.dotc.transform.MegaPhase.$anonfun$1(MegaPhase.scala:378)
       	at scala.collection.immutable.List.mapConserve(List.scala:176)
       	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:378)
       	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:334)
       	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:337)
       	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:365)
       	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:384)
       	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:396)
       	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:289)
       	at scala.collection.immutable.List.map(List.scala:287)
       	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:291)
       	at dotty.tools.dotc.Run.op$4(Run.scala:125)
       	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:123)
       	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
       	at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
       	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
       	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
       	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:191)
       	at dotty.tools.dotc.Run.runPhases$2(Run.scala:136)
       	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:141)
       	at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
       	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:86)
       	at dotty.tools.dotc.Run.compileUnits(Run.scala:143)
       	at dotty.tools.dotc.Run.compileSources(Run.scala:94)
       	at dotty.tools.dotc.Run.compile(Run.scala:78)
       	at dotty.tools.dotc.Driver.doCompile(Driver.scala:29)
       	at dotty.tools.dotc.Driver.process(Driver.scala:127)
       	at xsbt.CachedCompilerImpl.run(CompilerInterface.scala:63)
       	at xsbt.CachedCompilerImpl.run(CompilerInterface.scala:53)
       	at xsbt.CompilerInterface.run(CompilerInterface.scala:37)
       	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
       	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       	at java.lang.reflect.Method.invoke(Method.java:498)
       	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:107)
       	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:53)
       	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
       	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)
       	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
       	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
       	at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)
       	at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)
       	at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)
       	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
       	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
       	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
       	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
       	at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
       	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:72)
       	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:71)
       	at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:99)
       	at sbt.inc.Incremental$.compile(Incremental.scala:71)
       	at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
       	at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
       	at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
       	at sbt.Compiler$.compile(Compiler.scala:155)
       	at sbt.Compiler$.compile(Compiler.scala:141)
       	at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:913)
       	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:904)
       	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:902)
       	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:228)
       	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
       	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
       	at sbt.Execute.work(Execute.scala:237)
       	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
       	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
       	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:266)
       	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
       	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
       	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
       	at java.lang.Thread.run(Thread.java:745)
[error] (collectionsJVM/compile:compileIncremental) java.lang.AssertionError: assertion failed: bad parameter reference this.T at tryCatchPatterns
[error] the parameter is type T in class IntMapIterator but the prefix strawman.collection.immutable.IntMapIterator(this)
[error] does not define any corresponding arguments.

The code was ported from Scala 2.12 and compiles on 2.13.0-M2 in the new design.

Build log at https://travis-ci.org/scala/collection-strawman/builds/326357464

@allanrenucci
Copy link
Contributor

Minimal reproduction:

trait Iterator[A] {
  def next(): A
}

class IntMapIterator[T] extends Iterator[T] {
  def next: T = ??? // crashes
  // def next(): T = ??? // OK
}

@allanrenucci allanrenucci removed their assignment Jan 8, 2018
smarter added a commit to dotty-staging/dotty that referenced this issue Jan 8, 2018
A non-applied class TypeRef is not a valid prefix for a TypeRef of a
class type parameter, it causes an assertion error in NamedType#argDenot
because args.nonEmpty ends up false.
msteindorfer added a commit to msteindorfer/collection-strawman that referenced this issue Jan 18, 2018
allanrenucci added a commit that referenced this issue Jan 18, 2018
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

3 participants