Expected: All 4 examples should compile.
Actual: example 'notWork' won't compile because it can't infer a type for Option.empty thru the CPS transform
Exception during sealing to F[T], T=scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]], otpe=OrType(AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing))))))),AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String))))))))
CpsTree.getClass class cps.macros.forest.CpsTreeScope$AwaitSyncCpsTree
candidate = Match(Apply(Select(Apply(Select(Ident(System),currentTimeMillis),List()),%),List(Literal(Constant(2)))),List(CaseDef(Literal(Constant(0)),EmptyTree,Inlined(Apply(Apply(TypeApply(Ident(await),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))], TypeTree[TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeVar(TypeParamRef(A) -> TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))))),List(Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))), Ident(contextual$4))),List(ValDef(self$proxy7,TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1)))), ValDef(x$2$proxy7,TypeTree[AndType(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsConcurrentEffectMonad),List(TypeRef(NoPrefix,type F))),AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsMonadInstanceContext),List(TypeRef(NoPrefix,type F))))],Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1))))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),flatMap),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))])),List(Ident(self$proxy7))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],EmptyTree))),TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))))],Block(List(ValDef(a0,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],Ident(x))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),map),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))])),List(Apply(TypeApply(Select(Ident(cpsMonad),pure),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(ArrowAssoc),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)])),List(Literal(Constant(k)))),->),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Ident(a0))))))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],EmptyTree))),TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))],Block(List(ValDef(a0,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Ident(x)), ValDef(a1,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))],TypeApply(Select(Ident(Option),empty),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)])))),Apply(TypeApply(Select(Ident(Tuple2),apply),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))])),List(Ident(a0), Ident(a1)))))),Closure(List(),Ident($anonfun),EmptyTree))))))),Closure(List(),Ident($anonfun),EmptyTree)))))), CaseDef(Literal(Constant(1)),EmptyTree,Inlined(Apply(Apply(TypeApply(Ident(await),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))], TypeTree[TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeVar(TypeParamRef(A) -> TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))))),List(Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))), Ident(contextual$4))),List(ValDef(self$proxy8,TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1)))), ValDef(x$2$proxy8,TypeTree[AndType(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsConcurrentEffectMonad),List(TypeRef(NoPrefix,type F))),AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsMonadInstanceContext),List(TypeRef(NoPrefix,type F))))],Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1))))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),flatMap),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))])),List(Ident(self$proxy8))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],EmptyTree))),TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))))],Block(List(ValDef(a0,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],Ident(x))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),map),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))])),List(Apply(TypeApply(Select(Ident(cpsMonad),pure),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(ArrowAssoc),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)])),List(Literal(Constant(k)))),->),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Ident(a0))))))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],EmptyTree))),TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))],Block(List(ValDef(a0,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Ident(x)), ValDef(a1,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))],Apply(TypeApply(Select(Ident(Option),apply),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)])),List(Literal(Constant(foo)))))),Apply(TypeApply(Select(Ident(Tuple2),apply),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))])),List(Ident(a0), Ident(a1)))))),Closure(List(),Ident($anonfun),EmptyTree))))))),Closure(List(),Ident($anonfun),EmptyTree))))))))
scala.quoted.runtime.impl.ExprCastException:
Expected type: F[scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]]]
Actual type: F[scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]]] | F[scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]]]
Expression:
java.lang.System.currentTimeMillis().%(2) match {
case 0L =>
{
val self$proxy7: F[scala.Int] = cats.implicits.catsSyntaxApplicativeId[scala.Int](1).pure[F](evidence$1)
val x$2$proxy7: cps.CpsConcurrentEffectMonad[F] & cps.CpsMonadInstanceContext[F] = cats.effect.cps.catsEffectCpsConcurrentMonad[F](evidence$1)
cpsMonad.flatMap[scala.Int, scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]]](self$proxy7)(((x: scala.Int) => {
val a0: scala.Int = x
cpsMonad.map[scala.Tuple2[java.lang.String, scala.Int], scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]]](cpsMonad.pure[scala.Tuple2[java.lang.String, scala.Int]](scala.Predef.ArrowAssoc[java.lang.String]("k").->[scala.Int](a0)))(((`x₂`: scala.Tuple2[java.lang.String, scala.Int]) => {
val `a0₂`: scala.Tuple2[java.lang.String, scala.Int] = `x₂`
val a1: scala.Option[scala.Nothing] = scala.Option.empty[scala.Nothing]
scala.Tuple2.apply[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]](`a0₂`, a1)
}))
}))
}
case 1L =>
{
val self$proxy8: F[scala.Int] = cats.implicits.catsSyntaxApplicativeId[scala.Int](1).pure[F](evidence$1)
val x$2$proxy8: cps.CpsConcurrentEffectMonad[F] & cps.CpsMonadInstanceContext[F] = cats.effect.cps.catsEffectCpsConcurrentMonad[F](evidence$1)
cpsMonad.flatMap[scala.Int, scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]]](self$proxy8)(((`x₃`: scala.Int) => {
val `a0₃`: scala.Int = `x₃`
cpsMonad.map[scala.Tuple2[java.lang.String, scala.Int], scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]]](cpsMonad.pure[scala.Tuple2[java.lang.String, scala.Int]](scala.Predef.ArrowAssoc[java.lang.String]("k").->[scala.Int](`a0₃`)))(((`x₄`: scala.Tuple2[java.lang.String, scala.Int]) => {
val `a0₄`: scala.Tuple2[java.lang.String, scala.Int] = `x₄`
val `a1₂`: scala.Option[java.lang.String] = scala.Option.apply[java.lang.String]("foo")
scala.Tuple2.apply[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]](`a0₄`, `a1₂`)
}))
}))
}
}
at scala.quoted.runtime.impl.ExprCastException$.apply(ExprCastException.scala:15)
at scala.quoted.runtime.impl.QuotesImpl.asExprOf(QuotesImpl.scala:78)
at scala.quoted.runtime.impl.QuotesImpl$reflect$TreeMethods$.asExprOf(QuotesImpl.scala:126)
at scala.quoted.runtime.impl.QuotesImpl$reflect$TreeMethods$.asExprOf(QuotesImpl.scala:125)
at cps.macros.forest.CpsTreeScope$CpsTree.safeSealAs$1(CpsTree.scala:82)
at cps.macros.forest.CpsTreeScope$CpsTree.toResult(CpsTree.scala:97)
at cps.macros.forest.MatchTreeTransform$Bridge$1.bridge(MatchTreeTransform.scala:83)
at cps.macros.forest.MatchTreeTransform$.run(MatchTreeTransform.scala:87)
at cps.macros.Async$.rootTransform(Async.scala:265)
at cps.macros.Async$.nestTransform(Async.scala:294)
at cps.macros.forest.RootTreeTransform.liftedTree2$1(RootTreeTransform.scala:69)
at cps.macros.forest.RootTreeTransform.runRoot(RootTreeTransform.scala:83)
at cps.macros.forest.RootTreeTransform.runRoot$(RootTreeTransform.scala:14)
at cps.macros.forest.RootTreeTransform$$anon$2.runRoot(RootTreeTransform.scala:167)
at cps.macros.forest.InlinedTreeTransform.runInlined(InlinedTreeTransform.scala:236)
at cps.macros.forest.InlinedTreeTransform.runInlined$(InlinedTreeTransform.scala:14)
at cps.macros.forest.RootTreeTransform$$anon$2.runInlined(RootTreeTransform.scala:167)
at cps.macros.forest.RootTreeTransform.$anonfun$3(RootTreeTransform.scala:52)
at cps.macros.forest.RootTreeTransform$B2$.inNestedContext(RootTreeTransform.scala:160)
at cps.macros.forest.RootTreeTransform.runRoot(RootTreeTransform.scala:53)
at cps.macros.forest.RootTreeTransform.runRoot$(RootTreeTransform.scala:14)
at cps.macros.forest.InlinedTreeTransform$Bridge$1.runRoot(InlinedTreeTransform.scala:275)
at cps.macros.forest.InlinedTreeTransform.runInlined(InlinedTreeTransform.scala:236)
at cps.macros.forest.InlinedTreeTransform.runInlined$(InlinedTreeTransform.scala:14)
at cps.macros.forest.InlinedTreeTransform$Bridge$1.runInlined(InlinedTreeTransform.scala:275)
at cps.macros.forest.InlinedTreeTransform$Bridge$1.bridge(InlinedTreeTransform.scala:285)
at cps.macros.forest.InlinedTreeTransform$.run(InlinedTreeTransform.scala:289)
at cps.macros.Async$.rootTransform(Async.scala:272)
at cps.macros.Async$.$anonfun$1(Async.scala:116)
at cps.macros.misc.WithOptExprProxy$.apply(WithOptExprProxy.scala:26)
at cps.macros.Async$.transformMonad(Async.scala:139)
at cps.macros.Async$.transformImpl(Async.scala:64)
at cps.macros.Async$.transformNotInlined$1(Async.scala:321)
at cps.macros.Async$.$anonfun$7(Async.scala:328)
at cps.macros.Async$.inInlined$1(Async.scala:302)
at cps.macros.Async$.transformContextLambdaImpl(Async.scala:328)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at dotty.tools.dotc.quoted.Interpreter.interpretedStaticMethodCall$$anonfun$1(Interpreter.scala:174)
at dotty.tools.dotc.quoted.Interpreter.stopIfRuntimeException(Interpreter.scala:231)
at dotty.tools.dotc.quoted.Interpreter.interpretedStaticMethodCall(Interpreter.scala:174)
at dotty.tools.dotc.quoted.Interpreter.interpretTree(Interpreter.scala:80)
at dotty.tools.dotc.transform.Splicer$SpliceInterpreter.interpretTree(Splicer.scala:267)
at dotty.tools.dotc.quoted.Interpreter.interpretTree$$anonfun$2(Interpreter.scala:99)
at dotty.tools.dotc.transform.Splicer$.$anonfun$2(Splicer.scala:62)
at scala.Option.fold(Option.scala:263)
at dotty.tools.dotc.transform.Splicer$.splice(Splicer.scala:62)
at dotty.tools.dotc.inlines.Inliner.dotty$tools$dotc$inlines$Inliner$$expandMacro(Inliner.scala:1117)
at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedSplice(Inliner.scala:864)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3569)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3608)
at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:969)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3685)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3690)
at dotty.tools.dotc.inlines.Inliner.inlined(Inliner.scala:699)
at dotty.tools.dotc.inlines.Inlines$InlineCall.expand(Inlines.scala:560)
at dotty.tools.dotc.inlines.Inlines$.inlineCall(Inlines.scala:167)
at dotty.tools.dotc.inlines.Inliner$InlineTyper.inlineIfNeeded(Inliner.scala:965)
at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedApply(Inliner.scala:845)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3523)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3608)
at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:969)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.$anonfun$7(ProtoTypes.scala:543)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.cacheTypedArg(ProtoTypes.scala:466)
at dotty.tools.dotc.typer.ProtoTypes$FunProto.typedArg(ProtoTypes.scala:544)
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1045)
failed seal:java.lang.System.currentTimeMillis().%(2) match {
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.typedArg(Applications.scala:1045)
case 0L =>
at dotty.tools.dotc.typer.Applications$Application.addTyped$1(Applications.scala:724)
{
at dotty.tools.dotc.typer.Applications$Application.matchArgs(Applications.scala:792)
val self$proxy7: F[scala.Int] = cats.implicits.catsSyntaxApplicativeId[scala.Int](1).pure[F](evidence$1)
at dotty.tools.dotc.typer.Applications$Application.init(Applications.scala:605)
val x$2$proxy7: cps.CpsConcurrentEffectMonad[F] & cps.CpsMonadInstanceContext[F] = cats.effect.cps.catsEffectCpsConcurrentMonad[F](evidence$1)
at dotty.tools.dotc.typer.Applications$TypedApply.<init>(Applications.scala:918)
cpsMonad.flatMap[scala.Int, scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]]](self$proxy7)(((x: scala.Int) => {
at dotty.tools.dotc.typer.Applications$ApplyToUntyped.<init>(Applications.scala:1044)
val a0: scala.Int = x
at dotty.tools.dotc.typer.Applications.ApplyTo(Applications.scala:1313)
cpsMonad.map[scala.Tuple2[java.lang.String, scala.Int], scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]]](cpsMonad.pure[scala.Tuple2[java.lang.String, scala.Int]](scala.Predef.ArrowAssoc[java.lang.String]("k").->[scala.Int](a0)))(((`x₂`: scala.Tuple2[java.lang.String, scala.Int]) => {
at dotty.tools.dotc.typer.Applications.ApplyTo$(Applications.scala:465)
val `a0₂`: scala.Tuple2[java.lang.String, scala.Int] = `x₂`
at dotty.tools.dotc.typer.Typer.ApplyTo(Typer.scala:151)
val a1: scala.Option[scala.Nothing] = scala.Option.empty[scala.Nothing]
at dotty.tools.dotc.typer.Applications.simpleApply$1(Applications.scala:1117)
scala.Tuple2.apply[scala.Tuple2[java.lang.String, scala.Int], scala.Option[scala.Nothing]](`a0₂`, a1)
at dotty.tools.dotc.typer.Applications.$anonfun$14(Applications.scala:1227)
}))
at dotty.tools.dotc.typer.Typer$.tryEither(Typer.scala:124)
}))
at dotty.tools.dotc.typer.Applications.realApply$1(Applications.scala:1242)
}
at dotty.tools.dotc.typer.Applications.typedApply(Applications.scala:1287)
case 1L =>
at dotty.tools.dotc.typer.Applications.typedApply$(Applications.scala:465)
{
at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedApply(Inliner.scala:845)
val self$proxy8: F[scala.Int] = cats.implicits.catsSyntaxApplicativeId[scala.Int](1).pure[F](evidence$1)
at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3523)
val x$2$proxy8: cps.CpsConcurrentEffectMonad[F] & cps.CpsMonadInstanceContext[F] = cats.effect.cps.catsEffectCpsConcurrentMonad[F](evidence$1)
at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3608)
cpsMonad.flatMap[scala.Int, scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]]](self$proxy8)(((`x₃`: scala.Int) => {
at dotty.tools.dotc.inlines.Inliner$InlineTyper.typedUnadapted(Inliner.scala:969)
val `a0₃`: scala.Int = `x₃`
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3685)
cpsMonad.map[scala.Tuple2[java.lang.String, scala.Int], scala.Tuple2[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]]](cpsMonad.pure[scala.Tuple2[java.lang.String, scala.Int]](scala.Predef.ArrowAssoc[java.lang.String]("k").->[scala.Int](`a0₃`)))(((`x₄`: scala.Tuple2[java.lang.String, scala.Int]) => {
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3682)
val `a0₄`: scala.Tuple2[java.lang.String, scala.Int] = `x₄`
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3690)
val `a1₂`: scala.Option[java.lang.String] = scala.Option.apply[java.lang.String]("foo")
at dotty.tools.dotc.inlines.Inliner.inlined(Inliner.scala:699)
scala.Tuple2.apply[scala.Tuple2[java.lang.String, scala.Int], scala.Option[java.lang.String]](`a0₄`, `a1₂`)
at dotty.tools.dotc.inlines.Inlines$InlineCall.expand(Inlines.scala:560)
}))
at dotty.tools.dotc.inlines.Inlines$.inlineCall(Inlines.scala:167)
}))
at dotty.tools.dotc.inlines.Inlines$.inlineCall(Inlines.scala:161)
}
at dotty.tools.dotc.typer.Typer.adaptNoArgsOther$1(Typer.scala:4455)
}
at dotty.tools.dotc.typer.Typer.adaptNoArgs$1(Typer.scala:4563)
transformed.tpe=OrType(AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing))))))),AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String))))))))
at dotty.tools.dotc.typer.Typer.adapt1(Typer.scala:4825)
cpsTree=AwaitSyncCpsTree(Match(Apply(Select(Apply(Select(Ident(System),currentTimeMillis),List()),%),List(Literal(Constant(2)))),List(CaseDef(Literal(Constant(0)),EmptyTree,Inlined(Apply(Apply(TypeApply(Ident(await),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))], TypeTree[TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeVar(TypeParamRef(A) -> TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))))),List(Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))), Ident(contextual$4))),List(ValDef(self$proxy7,TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1)))), ValDef(x$2$proxy7,TypeTree[AndType(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsConcurrentEffectMonad),List(TypeRef(NoPrefix,type F))),AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsMonadInstanceContext),List(TypeRef(NoPrefix,type F))))],Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1))))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),flatMap),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))])),List(Ident(self$proxy7))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],EmptyTree))),TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))))],Block(List(ValDef(a0,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],Ident(x))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),map),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))])),List(Apply(TypeApply(Select(Ident(cpsMonad),pure),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(ArrowAssoc),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)])),List(Literal(Constant(k)))),->),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Ident(a0))))))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],EmptyTree))),TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))))],Block(List(ValDef(a0,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Ident(x)), ValDef(a1,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))],TypeApply(Select(Ident(Option),empty),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)])))),Apply(TypeApply(Select(Ident(Tuple2),apply),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Nothing)))])),List(Ident(a0), Ident(a1)))))),Closure(List(),Ident($anonfun),EmptyTree))))))),Closure(List(),Ident($anonfun),EmptyTree)))))), CaseDef(Literal(Constant(1)),EmptyTree,Inlined(Apply(Apply(TypeApply(Ident(await),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))], TypeTree[TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeVar(TypeParamRef(A) -> TypeVar(TypeParamRef(A) -> TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))))),List(Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeVar(TypeParamRef(F) -> TypeRef(NoPrefix,type F))])),List(Ident(evidence$1))), Ident(contextual$4))),List(ValDef(self$proxy8,TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Apply(TypeApply(Select(Apply(TypeApply(Ident(catsSyntaxApplicativeId),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Literal(Constant(1)))),pure),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1)))), ValDef(x$2$proxy8,TypeTree[AndType(AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsConcurrentEffectMonad),List(TypeRef(NoPrefix,type F))),AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cps),CpsMonadInstanceContext),List(TypeRef(NoPrefix,type F))))],Apply(TypeApply(Ident(catsEffectCpsConcurrentMonad),List(TypeTree[TypeRef(NoPrefix,type F)])),List(Ident(evidence$1))))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),flatMap),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))])),List(Ident(self$proxy8))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],EmptyTree))),TypeTree[AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))))],Block(List(ValDef(a0,TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],Ident(x))),Apply(Apply(TypeApply(Select(Ident(cpsMonad),map),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))])),List(Apply(TypeApply(Select(Ident(cpsMonad),pure),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))])),List(Apply(TypeApply(Select(Apply(TypeApply(Ident(ArrowAssoc),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)])),List(Literal(Constant(k)))),->),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)])),List(Ident(a0))))))),List(Block(List(DefDef($anonfun,List(List(ValDef(x,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],EmptyTree))),TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))],Block(List(ValDef(a0,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))],Ident(x)), ValDef(a1,TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))],Apply(TypeApply(Select(Ident(Option),apply),List(TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)])),List(Literal(Constant(foo)))))),Apply(TypeApply(Select(Ident(Tuple2),apply),List(TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)))], TypeTree[AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))])),List(Ident(a0), Ident(a1)))))),Closure(List(),Ident($anonfun),EmptyTree))))))),Closure(List(),Ident($anonfun),EmptyTree)))))))),AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String))))))
at dotty.tools.dotc.typer.Typer.adapt(Typer.scala:4065)
F[T]=AppliedType(TypeRef(NoPrefix,type F),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Tuple2),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String), TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int))), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Option),List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class String)))))))
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3685)
at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3690)
at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3801)
at dotty.tools.dotc.typer.Typer.$anonfun$66(Typer.scala:2921)
(Note: I'm raising this in https://github.com/typelevel/cats-effect-cps but it's probably more relevant to https://github.com/dotty-cps-async/dotty-cps-async/ )
Expected: All 4 examples should compile.
Actual: example 'notWork' won't compile because it can't infer a type for Option.empty thru the CPS transform
https://scastie.scala-lang.org/W62grMHvQ0GK5MoZNfxuIg
PS also, the extremely long error messages the CPS transformer emits are very off-putting and an obstacle to adoption.
Error reporting is a feature. This is very promising technology but I would be laughing stock if I proposed adopting this tool in an industry team with the current error behavior. I think detailed error diagnostics need to be opt-in with a flag. Most end users would not use nor interpret such output anyway.
Example: