{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/5550","repository_url":"https://api.github.com/repos/lampepfl/dotty","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/5550/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/5550/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/5550/events","html_url":"https://github.com/lampepfl/dotty/issues/5550","id":386363790,"node_id":"MDU6SXNzdWUzODYzNjM3OTA=","number":5550,"title":"ClassCastException when typechecking dependent function value with certain return type","user":{"login":"kory33","id":6561358,"node_id":"MDQ6VXNlcjY1NjEzNTg=","avatar_url":"https://avatars3.githubusercontent.com/u/6561358?v=4","gravatar_id":"","url":"https://api.github.com/users/kory33","html_url":"https://github.com/kory33","followers_url":"https://api.github.com/users/kory33/followers","following_url":"https://api.github.com/users/kory33/following{/other_user}","gists_url":"https://api.github.com/users/kory33/gists{/gist_id}","starred_url":"https://api.github.com/users/kory33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kory33/subscriptions","organizations_url":"https://api.github.com/users/kory33/orgs","repos_url":"https://api.github.com/users/kory33/repos","events_url":"https://api.github.com/users/kory33/events{/privacy}","received_events_url":"https://api.github.com/users/kory33/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-30T21:51:35Z","updated_at":"2018-12-11T23:52:49Z","closed_at":null,"author_association":"NONE","body":"This can be reproduced in both `0.12.0-bin-20181129-2ec79d1-NIGHTLY` and `0.11.0-RC1`\r\n\r\n```Scala\r\nobject Test {\r\n  trait Wrap { type T }\r\n\r\n  // this compiles\r\n  def test11[A](ev: (e: Wrap) => List[e.T]): List[A] = ev(new Wrap { type T = A })\r\n  def test12[A]: List[A] = test11 { w: Wrap => List() }\r\n\r\n  // but this does not when the commented code is included (compiler crashes with stack trace)\r\n  def test21[F[_], A](ev: (e: Wrap) => F[e.T]): F[A] = ??? // ev(new Wrap { type T = A })\r\n  def test22[A]: List[A] = test21[List, A] { w: Wrap => List() }\r\n}\r\n```\r\nStack trace:\r\n```\r\njava.lang.ClassCastException: dotty.tools.dotc.core.Types$LambdaParam cannot be cast to dotty.tools.dotc.core.Symbols$Symbol\r\n        at dotty.tools.dotc.core.TypeComparer.compareCaptured$1(TypeComparer.scala:990)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubArg$1(TypeComparer.scala:1002)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubArgs(TypeComparer.scala:1011)\r\n        at dotty.tools.dotc.core.TypeComparer.isMatchingApply$1(TypeComparer.scala:743)\r\n        at dotty.tools.dotc.core.TypeComparer.compareAppliedType2$1(TypeComparer.scala:846)\r\n        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:428)\r\n        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)\r\n        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)\r\n        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)\r\n        at dotty.tools.dotc.core.TypeComparer.compareMethod$1(TypeComparer.scala:562)\r\n        at dotty.tools.dotc.core.TypeComparer.thirdTry$1(TypeComparer.scala:565)\r\n        at dotty.tools.dotc.core.TypeComparer.secondTry$1(TypeComparer.scala:388)\r\n        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:307)\r\n        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)\r\n        at dotty.tools.dotc.core.ConstraintHandling.isSubTypeWhenFrozen(ConstraintHandling.scala:185)\r\n        at dotty.tools.dotc.core.Types$Type.frozen_$less$colon$less(Types.scala:831)\r\n        at dotty.tools.dotc.core.Types$Type.overrides(Types.scala:867)\r\n        at dotty.tools.dotc.core.Denotations$Denotation.prefer$2(Denotations.scala:520)\r\n        at dotty.tools.dotc.core.Denotations$Denotation.mergeSingleDenot$1(Denotations.scala:530)\r\n        at dotty.tools.dotc.core.Denotations$Denotation.mergeDenot$1(Denotations.scala:456)\r\n        at dotty.tools.dotc.core.Denotations$Denotation.$amp(Denotations.scala:562)\r\n        at dotty.tools.dotc.core.Types$Type.goRefined$1(Types.scala:653)\r\n        at dotty.tools.dotc.core.Types$Type.go$1(Types.scala:569)\r\n        at dotty.tools.dotc.core.Types$Type.findMember(Types.scala:702)\r\n        at dotty.tools.dotc.core.Types$Type.memberExcluding(Types.scala:532)\r\n        at dotty.tools.dotc.core.Types$Type.member(Types.scala:518)\r\n        at dotty.tools.dotc.typer.ProtoTypes$SelectionProto.isMatchedBy(ProtoTypes.scala:135)\r\n        at dotty.tools.dotc.core.TypeComparer.isMatchedByProto(TypeComparer.scala:1206)\r\n        at dotty.tools.dotc.core.TypeComparer.firstTry$1(TypeComparer.scala:234)\r\n        at dotty.tools.dotc.core.TypeComparer.recur(TypeComparer.scala:942)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:132)\r\n        at dotty.tools.dotc.core.TypeComparer.isSubType(TypeComparer.scala:139)\r\n        at dotty.tools.dotc.core.TypeComparer.topLevelSubType(TypeComparer.scala:118)\r\n        at dotty.tools.dotc.core.Types$Type.$less$colon$less(Types.scala:826)\r\n        at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$4(Typer.scala:2487)\r\n        at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:2549)\r\n        at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2683)\r\n        at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2224)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)\r\n        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)\r\n        at dotty.tools.dotc.typer.Typer.typeSelectOnTerm$1(Typer.scala:432)\r\n        at dotty.tools.dotc.typer.Typer.typedSelect(Typer.scala:461)\r\n        at dotty.tools.dotc.typer.Typer.tryApply$1(Typer.scala:2139)\r\n        at dotty.tools.dotc.typer.Typer.tryInsertApplyOrImplicit$$anonfun$2(Typer.scala:2157)\r\n        at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2075)\r\n        at dotty.tools.dotc.typer.Typer.tryInsertApplyOrImplicit(Typer.scala:2166)\r\n        at dotty.tools.dotc.typer.Typer.adaptToArgs$1(Typer.scala:2295)\r\n        at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:2678)\r\n        at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:2224)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)\r\n        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)\r\n        at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:743)\r\n        at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:842)\r\n        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1907)\r\n        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1961)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)\r\n        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)\r\n        at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1507)\r\n        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1894)\r\n        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1960)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)\r\n        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2023)\r\n        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2056)\r\n        at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1615)\r\n        at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1897)\r\n        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1960)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)\r\n        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2023)\r\n        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2056)\r\n        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1733)\r\n        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1939)\r\n        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1961)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1992)\r\n        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2004)\r\n        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2067)\r\n        at dotty.tools.dotc.typer.FrontEnd.typeCheck$$anonfun$1(FrontEnd.scala:60)\r\n        at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)\r\n        at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:34)\r\n        at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:64)\r\n        at dotty.tools.dotc.typer.FrontEnd.runOn$$anonfun$2(FrontEnd.scala:88)\r\n        at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)\r\n        at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)\r\n        at scala.collection.immutable.List.foreach(List.scala:388)\r\n        at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:88)\r\n        at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:172)\r\n        at scala.compat.java8.JProcedure1.apply(JProcedure1.java:18)\r\n        at scala.compat.java8.JProcedure1.apply(JProcedure1.java:10)\r\n        at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)\r\n        at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)\r\n        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:194)\r\n        at dotty.tools.dotc.Run.runPhases$5(Run.scala:184)\r\n        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:192)\r\n        at scala.compat.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)\r\n        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:90)\r\n        at dotty.tools.dotc.Run.compileUnits(Run.scala:199)\r\n        at dotty.tools.dotc.Run.compileSources(Run.scala:134)\r\n        at dotty.tools.dotc.Run.compile(Run.scala:118)\r\n        at dotty.tools.dotc.Driver.doCompile(Driver.scala:33)\r\n        at dotty.tools.dotc.Driver.process(Driver.scala:166)\r\n        at xsbt.CachedCompilerImpl.run(CompilerInterface.scala:61)\r\n        at xsbt.CachedCompilerImpl.run(CompilerInterface.scala:51)\r\n        at xsbt.CompilerInterface.run(CompilerInterface.scala:35)\r\n        at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n        at java.lang.reflect.Method.invoke(Method.java:498)\r\n        at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)\r\n        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)\r\n        at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)\r\n        at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)\r\n        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)\r\n        at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)\r\n        at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)\r\n        at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)\r\n        at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)\r\n        at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)\r\n        at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)\r\n        at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)\r\n        at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)\r\n        at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)\r\n        at sbt.internal.inc.Incremental$.compile(Incremental.scala:75)\r\n        at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)\r\n        at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)\r\n        at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1430)\r\n        at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1404)\r\n        at scala.Function1.$anonfun$compose$1(Function1.scala:44)\r\n        at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)\r\n        at sbt.std.Transform$$anon$4.work(System.scala:66)\r\n        at sbt.Execute.$anonfun$submit$2(Execute.scala:262)\r\n        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)\r\n        at sbt.Execute.work(Execute.scala:271)\r\n        at sbt.Execute.$anonfun$submit$1(Execute.scala:262)\r\n        at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)\r\n        at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n        at java.lang.Thread.run(Thread.java:748)\r\n```"},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/446407834","html_url":"https://github.com/lampepfl/dotty/issues/5550#issuecomment-446407834","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/5550","id":446407834,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NjQwNzgzNA==","user":{"login":"kory33","id":6561358,"node_id":"MDQ6VXNlcjY1NjEzNTg=","avatar_url":"https://avatars3.githubusercontent.com/u/6561358?v=4","gravatar_id":"","url":"https://api.github.com/users/kory33","html_url":"https://github.com/kory33","followers_url":"https://api.github.com/users/kory33/followers","following_url":"https://api.github.com/users/kory33/following{/other_user}","gists_url":"https://api.github.com/users/kory33/gists{/gist_id}","starred_url":"https://api.github.com/users/kory33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kory33/subscriptions","organizations_url":"https://api.github.com/users/kory33/orgs","repos_url":"https://api.github.com/users/kory33/repos","events_url":"https://api.github.com/users/kory33/events{/privacy}","received_events_url":"https://api.github.com/users/kory33/received_events","type":"User","site_admin":false},"created_at":"2018-12-11T23:52:49Z","updated_at":"2018-12-11T23:52:49Z","author_association":"NONE","body":"A minified version of the code is as follows:\r\n\r\n```Scala\r\nobject Test {\r\n  type Obj // this can be concrete as well\r\n  type F[_] // when this is abstract, compiler crashes\r\n  type Forall[G[_]] = (x: Obj) => G[x.type]\r\n\r\n  def idFn(ag: Forall[F]): Forall[F] = ag // crashes while checking ag.type <:< Forall[F]\r\n}\r\n```\r\n\r\nThe exception produced is the same as that in #4376."}}
{"actor":{"display_login":"kory33"}}