Skip to content

Erasure tries to cast to MethodType #569

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

Closed
DarkDimius opened this issue May 15, 2015 · 0 comments
Closed

Erasure tries to cast to MethodType #569

DarkDimius opened this issue May 15, 2015 · 0 comments

Comments

@DarkDimius
Copy link
Contributor

during compilation of Arrays.newRefArray the right hand side ??? is being adapted to type MethodType(List(length), List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,<root>)),scala),Int)), PolyParam(T)). I guess this should not happen.

      at scala.Predef$.assert(Predef.scala:165)
      at dotty.tools.dotc.ast.tpd$TreeOps$.asInstance$extension(tpd.scala:715)
      at dotty.tools.dotc.transform.Erasure$Boxing$.cast(Erasure.scala:232)
      at dotty.tools.dotc.transform.Erasure$Boxing$.adaptToType(Erasure.scala:264)
      at dotty.tools.dotc.transform.Erasure$Typer$$anonfun$adapt$2.apply(Erasure.scala:651)
      at dotty.tools.dotc.transform.Erasure$Typer$$anonfun$adapt$2.apply(Erasure.scala:647)
      at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:164)
      at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
      at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:148)
      at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
      at dotty.tools.dotc.transform.Erasure$Typer.adapt(Erasure.scala:647)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1089)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1087)
      at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
      at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
      at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1087)
      at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1126)
      at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:893)
      at dotty.tools.dotc.typer.Typer$$anonfun$typedDefDef$1.apply(Typer.scala:886)
      at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
      at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:886)
      at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:481)
      at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1027)
      at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1077)
      at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:93)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1089)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1087)
      at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
      at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
      at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1087)
      at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1111)
      at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1122)
      at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:540)
      at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:923)
      at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:905)
      at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
      at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:905)
      at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1030)
      at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1077)
      at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:93)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1089)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1087)
      at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
      at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
      at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1087)
      at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1111)
      at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1122)
      at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:540)
      at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:970)
      at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:961)
      at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
      at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:961)
      at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1067)
      at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1079)
      at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:93)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1089)
      at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1087)
      at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:147)
      at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:51)
      at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1087)
      at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1126)
      at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:72)
      at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:270)
      at dotty.tools.dotc.core.Phases$Phase$$anonfun$runOn$1.apply(Phases.scala:268)
      at scala.collection.immutable.List.map(List.scala:273)
      at dotty.tools.dotc.core.Phases$Phase$class.runOn(Phases.scala:268)
      at dotty.tools.dotc.transform.Erasure.runOn(Erasure.scala:30)
      at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:59)
      at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:56)
      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$compileUnits$1.apply$mcV$sp(Run.scala:56)
      at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
      at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:52)
      at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:68)
      at dotty.tools.dotc.Run.compileUnits(Run.scala:52)
      at dotty.tools.dotc.Run.compileSources(Run.scala:49)
      at dotty.tools.dotc.Run.compile(Run.scala:33)
      at dotty.tools.dotc.Driver.doCompile(Driver.scala:20)
      at dotty.tools.dotc.Bench$.dotty$tools$dotc$Bench$$super$doCompile(Bench.scala:38)
      at dotty.tools.dotc.Bench$$anonfun$doCompile$1.apply(Bench.scala:38)
      at dotty.tools.dotc.Bench$$anonfun$doCompile$1.apply(Bench.scala:36)
      at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
      at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
      at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
      at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
      at scala.collection.immutable.Range.foreach(Range.scala:166)
      at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:142)
      at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:104)
      at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:136)
      at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:104)
      at dotty.tools.dotc.Bench$.ntimes(Bench.scala:30)
      at dotty.tools.dotc.Bench$.doCompile(Bench.scala:36)
      at dotty.tools.dotc.Driver.process(Driver.scala:31)
      at dotty.tools.dotc.Bench$.dotty$tools$dotc$Bench$$super$process(Bench.scala:53)
      at dotty.tools.dotc.Bench$$anonfun$process$1.apply(Bench.scala:53)
      at dotty.tools.dotc.Bench$$anonfun$process$1.apply(Bench.scala:53)
      at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
      at dotty.tools.dotc.Bench$$anonfun$ntimes$1.apply(Bench.scala:30)
      at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
      at scala.collection.TraversableOnce$$anonfun$foldLeft$1.apply(TraversableOnce.scala:142)
      at scala.collection.immutable.Range.foreach(Range.scala:166)
      at scala.collection.TraversableOnce$class.foldLeft(TraversableOnce.scala:142)
      at scala.collection.AbstractTraversable.foldLeft(Traversable.scala:104)
      at scala.collection.TraversableOnce$class.$div$colon(TraversableOnce.scala:136)
      at scala.collection.AbstractTraversable.$div$colon(Traversable.scala:104)
      at dotty.tools.dotc.Bench$.ntimes(Bench.scala:30)
      at dotty.tools.dotc.Bench$.process(Bench.scala:53)
      at test.CompilerTest.compileArgs(CompilerTest.scala:183)
      at test.CompilerTest.compileDir(CompilerTest.scala:122)
      at dotc.tests.dotty_runtime(tests.scala:146)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.junit.runners.Suite.runChild(Suite.java:127)
      at org.junit.runners.Suite.runChild(Suite.java:26)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:138)
      at com.novocode.junit.JUnitRunner$1.execute(JUnitRunner.java:132)
      at sbt.ForkMain$Run$2.call(ForkMain.java:294)
      at sbt.ForkMain$Run$2.call(ForkMain.java:284)
      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)
odersky added a commit to dotty-staging/dotty that referenced this issue May 15, 2015
newRefArray needs to be treated specially at and after erasure because
it is the only source-defined method that's still polymoprhic.
odersky added a commit to dotty-staging/dotty that referenced this issue May 21, 2015
newRefArray needs to be treated specially at and after erasure because
it is the only source-defined method that's still polymoprhic.
DarkDimius added a commit that referenced this issue May 21, 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