Skip to content

Macros fail Ycheck when called in inline #4773

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
nicolasstucki opened this issue Jul 7, 2018 · 1 comment
Closed

Macros fail Ycheck when called in inline #4773

nicolasstucki opened this issue Jul 7, 2018 · 1 comment

Comments

@nicolasstucki
Copy link
Contributor

import scala.quoted._
object Foo {
  inline def foo2(): Unit = ~foo2Impl()
  def foo2Impl(): Expr[Unit] = '()
  inline def foo(): Unit = foo2()
}

fail Ycheck with

exception while typing inline def foo(): Unit = StagedStreams.foo2() of class class dotty.tools.dotc.ast.Trees$DefDef # 49
exception while typing @scala.annotation.internal.SourceFile(
  "tests/run-no-deep-subtypes/staged-streams-macro/staged-streams_1.scala"
) final module class StagedStreams() extends Object() { 
  this: StagedStreams.type =>
 
  inline def foo2(): Seq[Any] => Object = 
    {
      def $anonfun$1(x$0: Seq[Any]): quoted.Expr[Unit] = 
        {
          val tastyContext$1: scala.tasty.Tasty = 
            x$0.apply(0).asInstanceOf[scala.tasty.Tasty]
          StagedStreams.foo2Impl()
        }
      closure($anonfun$1)
    }
  def foo2Impl(): quoted.Expr[Unit] = 
    scala.runtime.quoted.Unpickler.liftedExpr[Unit](())
  inline def foo(): Unit = StagedStreams.foo2()
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 180
exception while typing package <empty> {
  import scala.quoted._
  final lazy module val StagedStreams: StagedStreams = new StagedStreams()
  @scala.annotation.internal.SourceFile(
    "tests/run-no-deep-subtypes/staged-streams-macro/staged-streams_1.scala"
  ) final module class StagedStreams() extends Object() { 
    this: StagedStreams.type =>
   
    inline def foo2(): Seq[Any] => Object = 
      {
        def $anonfun$1(x$0: Seq[Any]): quoted.Expr[Unit] = 
          {
            val tastyContext$1: scala.tasty.Tasty = 
              x$0.apply(0).asInstanceOf[scala.tasty.Tasty]
            StagedStreams.foo2Impl()
          }
        closure($anonfun$1)
      }
    def foo2Impl(): quoted.Expr[Unit] = 
      scala.runtime.quoted.Unpickler.liftedExpr[Unit](())
    inline def foo(): Unit = StagedStreams.foo2()
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 181
*** error while checking tests/run-no-deep-subtypes/staged-streams-macro/staged-streams_1.scala after phase reifyQuotes ***
exception occurred while compiling tests/run-no-deep-subtypes/staged-streams-macro/staged-streams_1.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: Types differ
Original type : Unit
After checking: Seq[Any] => Object
Original tree : StagedStreams.foo2()
After checking: StagedStreams.foo2()
Why different :
             Subtype trace:
  ==> Seq[Any] => Object <:< Unit  
  <== Seq[Any] => Object <:< Unit   = false
	at scala.Predef$.assert(Predef.scala:219)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedUnadapted(TreeChecker.scala:288)
	at dotty.tools.dotc.typer.Typer.$anonfun$typed$2(Typer.scala:1870)
	at dotty.tools.dotc.reporting.trace$.apply(trace.scala:40)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1866)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1882)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typed(TreeChecker.scala:263)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1941)
	at dotty.tools.dotc.typer.Typer.$anonfun$typedDefDef$1(Typer.scala:1428)
	at dotty.tools.dotc.util.Stats$.track(Stats.scala:35)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1410)
	at dotty.tools.dotc.transform.TreeChecker$Checker.super$typedDefDef(TreeChecker.scala:408)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedDefDef$2(TreeChecker.scala:408)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:179)
	at dotty.tools.dotc.transform.TreeChecker$Checker.$anonfun$typedDefDef$1(TreeChecker.scala:397)
	at dotty.tools.dotc.transform.TreeChecker$Checker.withDefinedSyms(TreeChecker.scala:179)
	at dotty.tools.dotc.transform.TreeChecker$Checker.typedDefDef(TreeChecker.scala:396)
...
@nicolasstucki
Copy link
Contributor Author

Possible duplicate of #4735

@nicolasstucki nicolasstucki self-assigned this Jul 18, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 18, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 21, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 23, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 26, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 27, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 27, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 27, 2018
* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant