You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This can be reproduced in both 0.12.0-bin-20181129-2ec79d1-NIGHTLY and 0.11.0-RC1
objectTest {
traitWrap { typeT }
// this compilesdeftest11[A](ev: (e: Wrap) =>List[e.T]):List[A] = ev(newWrap { typeT=A })
deftest12[A]:List[A] = test11 { w: Wrap=>List() }
// but this does not when the commented code is included (compiler crashes with stack trace)deftest21[F[_], A](ev: (e: Wrap) =>F[e.T]):F[A] =???// ev(new Wrap { type T = A })deftest22[A]:List[A] = test21[List, A] { w: Wrap=>List() }
}
Stack trace:
java.lang.ClassCastException: dotty.tools.dotc.core.Types$LambdaParam cannot be cast to dotty.tools.dotc.core.Symbols$Symbol
at dotty.tools.dotc.core.TypeComparer.compareCaptured$1(TypeComparer.scala:990)
at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:1002)
at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:1011)
at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:743)
at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:846)
at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)
at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
at dotty.tools.dotc.core.TypeComparer.compareMethod$1(TypeComparer.scala:562)
at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:565)
at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)
at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)
at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)
at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:831)
at dotty.tools.dotc.core.Types$Type.overrides(Types.scala:867)
at dotty.tools.dotc.core.Denotations$Denotation.prefer$2(Denotations.scala:520)
at dotty.tools.dotc.core.Denotations$Denotation.mergeSingleDenot$1(Denotations.scala:530)
at dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:456)
at dotty.tools.dotc.core.Denotations$Denotation.$amp(Denotations.scala:562)
at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:653)
at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)
at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)
at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)
at dotty.tools.dotc.core.Types$Type.member(Types.scala:518)
at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:135)
at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1206)
at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:234)
at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)
at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)
at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:118)
at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:826)
at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:2487)
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2549)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2683)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2224)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)
at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:432)
at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:461)
at dotty.tools.dotc.typer.Typer.tryApply$1(Typer.scala:2139)
at dotty.tools.dotc.typer.Typer.tryInsertApplyOrImplicit$$anonfun$2(Typer.scala:2157)
at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2075)
at dotty.tools.dotc.typer.Typer.tryInsertApplyOrImplicit(Typer.scala:2166)
at dotty.tools.dotc.typer.Typer.adaptToArgs$1(Typer.scala:2295)
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2678)
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2224)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:743)
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:842)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1907)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1961)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)
at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1507)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1894)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1960)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2023)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2056)
at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1615)
at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1897)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1960)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)
at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2023)
at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2056)
at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1733)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1939)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1961)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)
at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:60)
at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:34)
at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:64)
at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$2(FrontEnd.scala:88)
at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)
at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)
at scala.collection.immutable.List.foreach(List.scala:388)
at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:88)
at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:172)
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:194)
at dotty.tools.dotc.Run.runPhases$5(Run.scala:184)
at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:192)
at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:90)
at dotty.tools.dotc.Run.compileUnits(Run.scala:199)
at dotty.tools.dotc.Run.compileSources(Run.scala:134)
at dotty.tools.dotc.Run.compile(Run.scala:118)
at dotty.tools.dotc.Driver.doCompile(Driver.scala:33)
at dotty.tools.dotc.Driver.process(Driver.scala:166)
at xsbt.CachedCompilerImpl.run(CompilerInterface.scala:61)
at xsbt.CachedCompilerImpl.run(CompilerInterface.scala:51)
at xsbt.CompilerInterface.run(CompilerInterface.scala:35)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)
at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)
at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)
at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)
at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)
at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)
at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)
at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)
at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)
at sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1430)
at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1404)
at scala.Function1.$anonfun$compose$1(Function1.scala:44)
at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
at sbt.std.Transform$$anon$4.work(System.scala:66)
at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
at sbt.Execute.work(Execute.scala:271)
at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The text was updated successfully, but these errors were encountered:
This is sufficient to crash the compiler and the same stack trace was produced.
kory33
changed the title
ClassCastException when typechecking invocation of dependent function value with certain return type
ClassCastException when typechecking dependent function value with certain return type
Nov 30, 2018
objectTest {
typeObj// this can be concrete as welltypeF[_] // when this is abstract, compiler crashestypeForall[G[_]] = (x: Obj) =>G[x.type]
defidFn(ag: Forall[F]):Forall[F] = ag // crashes while checking ag.type <:< Forall[F]
}
The exception produced is the same as that in #4376.
This would be a duplicate of #4382, since a type (x: Obj) => F[x.type] expands to Function1[Obj, F[_ <: Obj]] { def apply(x: Obj): F[x.type] } and F[_ <: Obj] is an application of wildcard to an abstract type constructor F.
Uh oh!
There was an error while loading. Please reload this page.
This can be reproduced in both
0.12.0-bin-20181129-2ec79d1-NIGHTLY
and0.11.0-RC1
Stack trace:
The text was updated successfully, but these errors were encountered: