Skip to content

Assertion failed during retyping of inlined call. #11483

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
rssh opened this issue Feb 20, 2021 · 2 comments · Fixed by #11537
Closed

Assertion failed during retyping of inlined call. #11483

rssh opened this issue Feb 20, 2021 · 2 comments · Fixed by #11537

Comments

@rssh
Copy link
Contributor

rssh commented Feb 20, 2021

Compiler version

3.0.0-RC2-bin-20210219-aa7c21e-NIGHTLY

When trying to extract small example for another bug report.

Minimized code

X.scala:

package x


import scala.annotation._
import scala.quoted._
import scala.compiletime._


trait CpsMonad[F[_]]:

  def pure[T](x:T):F[T]

  def impure[T](x:F[T]):T

  def map[A,B](x:F[A])(f: A=>B):F[B]


@compileTimeOnly("await should be inside async block")
def await[F[_],T](f:F[T])(using am:CpsMonad[F]):T = ???

inline given conversion[F[_],T](using CpsMonad[F]): Conversion[F[T],T] =
           x => await(x)


object X {

 inline def process[F[_], T](inline t:T)(using m: CpsMonad[F]):F[T] =
    ${ processImpl[F,T]('t, 'm) }


 def processImpl[F[_]:Type, T:Type](t:Expr[T], m:Expr[CpsMonad[F]])(using Quotes):Expr[F[T]] =
   import quotes.reflect._
   val r = processTree[F,T](t.asTerm, m.asTerm)
   r.asExprOf[F[T]]


 def processTree[F[_]:Type, T:Type](using Quotes)(t: quotes.reflect.Term, m: quotes.reflect.Term):quotes.reflect.Term =
   import quotes.reflect._
   val r: Term = t match
     case Inlined(_,List(),body) => processTree[F,T](body, m)
     case Inlined(d,bindings,body) =>
       Inlined(d,bindings,processTree[F,T](body, m))
     case Block(stats,expr) => Block(stats,processTree(expr, m))
     case Apply(Apply(TypeApply(Ident("await"),targs),List(body)),List(m)) => body
     case Apply(f,List(arg)) =>
          val nArg = processTree[F,String](arg, m)
          Apply(Apply(TypeApply(Select.unique(m,"map"),
                               List(Inferred(arg.tpe.widen),Inferred(t.tpe.widen))
                      ),
                      List(nArg)),
                 List(f)
          )
     case Apply(f,List()) =>
          Apply(TypeApply(Select.unique(m,"pure"),List(Inferred(t.tpe.widen))),List(t))
     case Typed(x,tp) => Typed(processTree(x,m), Inferred(TypeRepr.of[F].appliedTo(tp.tpe)) )
     case _ => throw new RuntimeException(s"tree not recoginized: $t")
   r


}

and Main.x:

package x

import scala.language.implicitConversions
import scala.concurrent.Future

given FutureAsyncMonad: CpsMonad[Future] with
  def pure[T](t:T): Future[T] = ???
  def impure[T](t:Future[T]): T = ???
  def map[A,B](x:Future[A])(f: A=>B): Future[B] = ???


object Api:

  def doSomething():Future[String] =
    Future.successful("doSomething")

  def println(x:String):Unit =
    Console.println(x)


object Main:

  def main(args: Array[String]): Unit =
    X.process[Future,Unit]{
       Api.println(Api.doSomething())
    }

Output (click arrow to expand)

rssh@rssh4 wrong-compiletime-only % sbt compile                   
[info] welcome to sbt 1.4.5 (N/A Java 15.0.1)
[info] loading global plugins from /Users/rssh/.sbt/1.0/plugins
[info] loading settings for project wrong-compiletime-only-build from plugins.sbt ...
[info] loading project definition from /Users/rssh/tests/dotty/wrong-compiletime-only/project
Fetching latest Dotty nightly version...
Latest Dotty nightly build version: 3.0.0-RC2-bin-20210219-aa7c21e-NIGHTLY
[info] loading settings for project root from build.sbt ...
[info] set current project to test (in build file:/Users/rssh/tests/dotty/wrong-compiletime-only/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 2 Scala sources to /Users/rssh/tests/dotty/wrong-compiletime-only/target/scala-3.0.0-RC2/classes ...
java.lang.AssertionError: assertion failed while compiling /Users/rssh/tests/dotty/wrong-compiletime-only/src/main/scala/x/Main.scala, /Users/rssh/tests/dotty/wrong-compiletime-only/src/main/scala/x/X.scala
[error] ## Exception when compiling 2 sources to /Users/rssh/tests/dotty/wrong-compiletime-only/target/scala-3.0.0-RC2/classes
[error] java.lang.AssertionError: assertion failed
[error] scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
[error] dotty.tools.dotc.typer.EtaExpansion$.etaExpand(EtaExpansion.scala:226)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgsUnappliedMethod$2(Typer.scala:3383)
[error] dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3528)
[error] dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3751)
[error] dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3058)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:416)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:528)
[error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:593)
[error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:431)
[error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:697)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:801)
[error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1012)
[error] dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:301)
[error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:102)
[error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:859)
[error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:938)
[error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2852)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:949)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:987)
[error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:301)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1301)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$2(ProtoTypes.scala:414)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:370)
[error] dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:415)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:528)
[error] dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:593)
[error] dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:431)
[error] dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:697)
[error] dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:801)
[error] dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1012)
[error] dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:301)
[error] dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:102)
[error] dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:859)
[error] dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:938)
[error] dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2852)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:949)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:987)
[error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:301)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1301)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2844)
[error] dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:834)
[error] dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:987)
[error] dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:301)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1301)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2844)
[error] dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:979)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2605)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2721)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2844)
[error] dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1306)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62)
[error] dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2602)
[error] dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2721)
[error] dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] dotty.tools.dotc.typer.Inliner.inlined(Inliner.scala:803)
[error] dotty.tools.dotc.typer.Inliner$.inlineCall(Inliner.scala:139)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:86)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1422)
[error] scala.collection.immutable.List.mapConserve(List.scala:472)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1422)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1420)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1335)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:92)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:82)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:99)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.traverse$1(TreeMapWithImplicits.scala:53)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transformStats(TreeMapWithImplicits.scala:60)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:111)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1398)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:104)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:80)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform$$anonfun$1(Trees.scala:1422)
[error] scala.collection.immutable.List.mapConserve(List.scala:472)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1422)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transformStats(Trees.scala:1420)
[error] dotty.tools.dotc.ast.Trees$Instance$TreeMap.transform(Trees.scala:1407)
[error] dotty.tools.dotc.ast.TreeMapWithImplicits.transform(TreeMapWithImplicits.scala:104)
[error] dotty.tools.dotc.transform.Inlining$InliningTreeMap.transform(Inlining.scala:94)
[error] dotty.tools.dotc.transform.Inlining$$anon$2.transform(Inlining.scala:72)
[error] dotty.tools.dotc.transform.MacroTransform.run(MacroTransform.scala:21)
[error] dotty.tools.dotc.transform.Inlining.run(Inlining.scala:44)
[error] dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:303)
[error] scala.collection.immutable.List.map(List.scala:246)
[error] dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:304)
[error] dotty.tools.dotc.transform.Inlining.runOn(Inlining.scala:48)
[error] dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:205)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
[error] scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
[error] scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
[error] dotty.tools.dotc.Run.runPhases$5(Run.scala:215)
[error] dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:223)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
[error] dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:230)
[error] dotty.tools.dotc.Run.compileUnits(Run.scala:172)
[error] dotty.tools.dotc.Driver.finish(Driver.scala:60)
[error] dotty.tools.dotc.Driver.doCompile(Driver.scala:40)
[error] dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
[error] dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:92)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:186)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:241)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:176)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:157)
[error] sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:157)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:204)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:573)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:573)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:173)
[error] sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:171)
[error] sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:458)
[error] sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
[error] sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:261)
[error] sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:413)
[error] sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:498)
[error] sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:400)
[error] sbt.internal.inc.Incremental$.apply(Incremental.scala:165)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:573)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:491)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:2177)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$2(Defaults.scala:2134)
[error] sbt.internal.io.Retry$.apply(Retry.scala:40)
[error] sbt.internal.io.Retry$.apply(Retry.scala:23)
[error] sbt.internal.server.BspCompileTask$.compute(BspCompileTask.scala:31)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:2130)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] sbt.Execute.work(Execute.scala:291)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[error] java.base/java.lang.Thread.run(Thread.java:832)
[error]            
[error] java.lang.AssertionError: assertion failed
[error] 	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
[error] 	at dotty.tools.dotc.typer.EtaExpansion$.etaExpand(EtaExpansion.scala:226)
[error] 	at dotty.tools.dotc.typer.Typer.adaptNoArgsUnappliedMethod$2(Typer.scala:3383)
[error] 	at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:3528)
[error] 	at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:3751)
[error] 	at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:3058)
[error] 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:416)
[error] 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] 	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:528)
[error] 	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:593)
[error] 	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:431)
[error] 	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:697)
[error] 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:801)
[error] 	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1012)
[error] 	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:301)
[error] 	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:102)
[error] 	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:859)
[error] 	at dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:938)
[error] 	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2852)
[error] 	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:949)
[error] 	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:987)
[error] 	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:301)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1301)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$2(ProtoTypes.scala:414)
[error] 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:370)
[error] 	at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:415)
[error] 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:802)
[error] 	at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:528)
[error] 	at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:593)
[error] 	at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:431)
[error] 	at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:697)
[error] 	at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:801)
[error] 	at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1012)
[error] 	at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:301)
[error] 	at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:102)
[error] 	at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:859)
[error] 	at dotty.tools.dotc.typer.Applications.realApply$5$$anonfun$4(Applications.scala:938)
[error] 	at dotty.tools.dotc.typer.Typer.tryEither(Typer.scala:2852)
[error] 	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:949)
[error] 	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:987)
[error] 	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:301)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1301)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2844)
[error] 	at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:834)
[error] 	at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:987)
[error] 	at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:301)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1301)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2844)
[error] 	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:979)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2605)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2721)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] 	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2844)
[error] 	at dotty.tools.dotc.typer.Inliner$InlineTyper.typedApply(Inliner.scala:1306)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2597)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2728)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedTyped(ReTyper.scala:62)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2602)
[error] 	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2659)
[error] 	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:118)
[error] 	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2724)
@rssh
Copy link
Contributor Author

rssh commented Feb 20, 2021

wrong-compiletime-only.crash.tar.gz
The full sbt project is attached.

@nicolasstucki
Copy link
Contributor

The code has a bug. The call to Api.println is passed as a non-eta-expanded reference. It can be fixed with

     case Apply(f,List(arg)) =>
          val nArg = processTree[F,String](arg, m)
          Apply(Apply(TypeApply(Select.unique(m,"map"),
                               List(Inferred(arg.tpe.widen),Inferred(t.tpe.widen))
                      ),
                      List(nArg)),
-                 List(f)
+                 List(f.etaExpand(Symbol.spliceOwner))
          )

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 25, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 26, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants