Skip to content

Crash in macros during separate compilation #7322

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
anatoliykmetyuk opened this issue Sep 26, 2019 · 5 comments
Closed

Crash in macros during separate compilation #7322

anatoliykmetyuk opened this issue Sep 26, 2019 · 5 comments

Comments

@anatoliykmetyuk
Copy link
Contributor

anatoliykmetyuk commented Sep 26, 2019

Macros1.scala:

import scala.quoted.{ QuoteContext, Expr, Type }

trait M[T] {
  def f: Any
}

inline def g[T: Type](em: Expr[M[T]])(given QuoteContext) = '{$em.f}

Macros2.scala:

import scala.quoted.{ QuoteContext, Expr }

def h(m: Expr[M[String]])(given QuoteContext): Expr[Any] = g(m)

Compile them separately, e.g.:

sbt:dotty> ;dotty-bootstrapped/dotc ../pg/i6/Macros1.scala ;dotty-bootstrapped/dotc -classpath . ../pg/i6/Macros2.scala

You will get:

Crash
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Running (fork) dotty.tools.dotc.Main -classpath /Users/anatolii/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.13.1.jar:/Users/anatolii/Projects/dotty/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.20/dotty-library_0.20-0.20.0-bin-SNAPSHOT.jar ../pg/i7322/Macros_1.scala
[success] Total time: 9 s, completed Sep 27, 2019 3:01:59 PM
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[warn] Multiple main classes detected.  Run 'show discoveredMainClasses' to see the list
[info] Running (fork) dotty.tools.dotc.Main -classpath .:/Users/anatolii/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.13.1.jar:/Users/anatolii/Projects/dotty/dotty/library/../out/bootstrap/dotty-library-bootstrapped/scala-0.20/dotty-library_0.20-0.20.0-bin-SNAPSHOT.jar ../pg/i7322/Macros_2.scala
exception while typing {
  {
    def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
      quoted.Type[String]
     = evidence$1
    closure($anonfun$2)
  }
} of class class dotty.tools.dotc.ast.Trees$Inlined # 1486
exception while typing scala.collection.immutable.Nil.::[
  scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext) =>
    scala.quoted.Expr[Any]
  ) | scala.quoted.Type[?]
](
  {
    {
      def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
        quoted.Type[String]
       = evidence$1
      closure($anonfun$2)
    }
  }
) of class class dotty.tools.dotc.ast.Trees$Apply # 3244
exception while typing scala.collection.immutable.Nil.::[
  scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext) =>
    scala.quoted.Expr[Any]
  ) | scala.quoted.Type[?]
](
  {
    {
      def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
        quoted.Type[String]
       = evidence$1
      closure($anonfun$2)
    }
  }
).:: of class class dotty.tools.dotc.ast.Trees$Select # 3245
exception while typing scala.collection.immutable.Nil.::[
  scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext) =>
    scala.quoted.Expr[Any]
  ) | scala.quoted.Type[?]
](
  {
    {
      def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
        quoted.Type[String]
       = evidence$1
      closure($anonfun$2)
    }
  }
).::[
  scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext) =>
    scala.quoted.Expr[Any]
  ) | scala.quoted.Type[?]
] of class class dotty.tools.dotc.ast.Trees$TypeApply # 3246
exception while typing scala.collection.immutable.Nil.::[
  scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext) =>
    scala.quoted.Expr[Any]
  ) | scala.quoted.Type[?]
](
  {
    {
      def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
        quoted.Type[String]
       = evidence$1
      closure($anonfun$2)
    }
  }
).::[
  scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext) =>
    scala.quoted.Expr[Any]
  ) | scala.quoted.Type[?]
](
  {
    {
      def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
        (given quoted.QuoteContext) => quoted.Expr[M[String]]
       =
        {
          def $anonfun(given evidence$2: quoted.QuoteContext):
            quoted.Expr[M[String]]
           =
            {
              m
            }
          closure($anonfun)
        }
      closure($anonfun$1)
    }
  }
) of class class dotty.tools.dotc.ast.Trees$Apply # 3247
exception while typing scala.runtime.quoted.Unpickler.unpickleExpr$direct[Any](
  scala.collection.immutable.Nil.::[String](

      "XKGrH5GAAHmgaRPcQgAAneD27My4AAHuAYRBU1RzAYFmAYRqYXZhAYRsYW5nAoKCgwGGT2JqZWN0AoKEhT+CgYYBgSQBjGV2aWRlbmNlJDEkXwqDiIGJAYxxdW90ZVR5cGVUYWcBhlF1b3RlZBeBjAGFc2NhbGEBiGludGVybmFsAoKOjwGGPGluaXQ+AoKQjBeBkgKCk4s/gpGUAZBNYWNyb3NfMiRwYWNrYWdlF4GWAYc8ZW1wdHk+AYlQb3NpdGlvbnMBvy9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9pNzMyMi9NYWNyb3NfMS5zY2FsYYCrk6mMoHCHk4P/gYCDl4qkg/+BgRetjnWLUHWNNpCIhXCVVjOWb5d1l1A3mJmZhwGLAZOAhJoCoYB+voL6qH+jhYST/oCRgA=="

  )
,
  scala.collection.immutable.Nil.::[
    scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext)
       =>
    scala.quoted.Expr[Any]) | scala.quoted.Type[?]
  ](
    {
      {
        def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
          quoted.Type[String]
         = evidence$1
        closure($anonfun$2)
      }
    }
  ).::[
    scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext)
       =>
    scala.quoted.Expr[Any]) | scala.quoted.Type[?]
  ](
    {
      {
        def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
          (given quoted.QuoteContext) => quoted.Expr[M[String]]
         =
          {
            def $anonfun(given evidence$2: quoted.QuoteContext):
              quoted.Expr[M[String]]
             =
              {
                m
              }
            closure($anonfun)
          }
        closure($anonfun$1)
      }
    }
  )
) of class class dotty.tools.dotc.ast.Trees$Apply # 3248
exception while typing scala.runtime.quoted.Unpickler.unpickleExpr$direct[Any](
  scala.collection.immutable.Nil.::[String](

      "XKGrH5GAAHmgaRPcQgAAneD27My4AAHuAYRBU1RzAYFmAYRqYXZhAYRsYW5nAoKCgwGGT2JqZWN0AoKEhT+CgYYBgSQBjGV2aWRlbmNlJDEkXwqDiIGJAYxxdW90ZVR5cGVUYWcBhlF1b3RlZBeBjAGFc2NhbGEBiGludGVybmFsAoKOjwGGPGluaXQ+AoKQjBeBkgKCk4s/gpGUAZBNYWNyb3NfMiRwYWNrYWdlF4GWAYc8ZW1wdHk+AYlQb3NpdGlvbnMBvy9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9pNzMyMi9NYWNyb3NfMS5zY2FsYYCrk6mMoHCHk4P/gYCDl4qkg/+BgRetjnWLUHWNNpCIhXCVVjOWb5d1l1A3mJmZhwGLAZOAhJoCoYB+voL6qH+jhYST/oCRgA=="

  )
,
  scala.collection.immutable.Nil.::[
    scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext)
       =>
    scala.quoted.Expr[Any]) | scala.quoted.Type[?]
  ](
    {
      {
        def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
          quoted.Type[String]
         = evidence$1
        closure($anonfun$2)
      }
    }
  ).::[
    scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext)
       =>
    scala.quoted.Expr[Any]) | scala.quoted.Type[?]
  ](
    {
      {
        def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
          (given quoted.QuoteContext) => quoted.Expr[M[String]]
         =
          {
            def $anonfun(given evidence$2: quoted.QuoteContext):
              quoted.Expr[M[String]]
             =
              {
                m
              }
            closure($anonfun)
          }
        closure($anonfun$1)
      }
    }
  )
)(
  {
    x$2
  }
) of class class dotty.tools.dotc.ast.Trees$Apply # 3249
exception while typing {
  val evidence$1: quoted.Type[String] =
    scala.runtime.quoted.Unpickler.unpickleType$direct[String](
      scala.collection.immutable.Nil.::[String](

          "XKGrH5GAAB+NFPi9VAAAAOsA64QAAOoBhEFTVHMBhlN0cmluZwGEamF2YQGEbGFuZwKCgoMBiVBvc2l0aW9ucwG/L1VzZXJzL2FuYXRvbGlpL1Byb2plY3RzL2RvdHR5L2RvdHR5Ly4uL3BnL2k3MzIyL01hY3Jvc18yLnNjYWxhgIR1gTaEhYeGAOsA64SG"

      )
    , scala.collection.immutable.Nil)(x$2)
  scala.runtime.quoted.Unpickler.unpickleExpr$direct[Any](
    scala.collection.immutable.Nil.::[String](

        "XKGrH5GAAHmgaRPcQgAAneD27My4AAHuAYRBU1RzAYFmAYRqYXZhAYRsYW5nAoKCgwGGT2JqZWN0AoKEhT+CgYYBgSQBjGV2aWRlbmNlJDEkXwqDiIGJAYxxdW90ZVR5cGVUYWcBhlF1b3RlZBeBjAGFc2NhbGEBiGludGVybmFsAoKOjwGGPGluaXQ+AoKQjBeBkgKCk4s/gpGUAZBNYWNyb3NfMiRwYWNrYWdlF4GWAYc8ZW1wdHk+AYlQb3NpdGlvbnMBvy9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9pNzMyMi9NYWNyb3NfMS5zY2FsYYCrk6mMoHCHk4P/gYCDl4qkg/+BgRetjnWLUHWNNpCIhXCVVjOWb5d1l1A3mJmZhwGLAZOAhJoCoYB+voL6qH+jhYST/oCRgA=="

    )
  ,
    scala.collection.immutable.Nil.::[
      scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext)
         =>
      scala.quoted.Expr[Any]) | scala.quoted.Type[?]
    ](
      {
        {
          def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
            quoted.Type[String]
           = evidence$1
          closure($anonfun$2)
        }
      }
    ).::[
      scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext)
         =>
      scala.quoted.Expr[Any]) | scala.quoted.Type[?]
    ](
      {
        {
          def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
            (given quoted.QuoteContext) => quoted.Expr[M[String]]
           =
            {
              def $anonfun(given evidence$2: quoted.QuoteContext):
                quoted.Expr[M[String]]
               =
                {
                  m
                }
              closure($anonfun)
            }
          closure($anonfun$1)
        }
      }
    )
  )(
    {
      x$2
    }
  )
} of class class dotty.tools.dotc.ast.Trees$Inlined # 1527
exception while typing def h(m: quoted.Expr[M[String]])(given x$2: quoted.QuoteContext):
  quoted.Expr[Any]
 =
  {
    val evidence$1: quoted.Type[String] =
      scala.runtime.quoted.Unpickler.unpickleType$direct[String](
        scala.collection.immutable.Nil.::[String](

            "XKGrH5GAAB+NFPi9VAAAAOsA64QAAOoBhEFTVHMBhlN0cmluZwGEamF2YQGEbGFuZwKCgoMBiVBvc2l0aW9ucwG/L1VzZXJzL2FuYXRvbGlpL1Byb2plY3RzL2RvdHR5L2RvdHR5Ly4uL3BnL2k3MzIyL01hY3Jvc18yLnNjYWxhgIR1gTaEhYeGAOsA64SG"

        )
      , scala.collection.immutable.Nil)(x$2)
    scala.runtime.quoted.Unpickler.unpickleExpr$direct[Any](
      scala.collection.immutable.Nil.::[String](

          "XKGrH5GAAHmgaRPcQgAAneD27My4AAHuAYRBU1RzAYFmAYRqYXZhAYRsYW5nAoKCgwGGT2JqZWN0AoKEhT+CgYYBgSQBjGV2aWRlbmNlJDEkXwqDiIGJAYxxdW90ZVR5cGVUYWcBhlF1b3RlZBeBjAGFc2NhbGEBiGludGVybmFsAoKOjwGGPGluaXQ+AoKQjBeBkgKCk4s/gpGUAZBNYWNyb3NfMiRwYWNrYWdlF4GWAYc8ZW1wdHk+AYlQb3NpdGlvbnMBvy9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9pNzMyMi9NYWNyb3NfMS5zY2FsYYCrk6mMoHCHk4P/gYCDl4qkg/+BgRetjnWLUHWNNpCIhXCVVjOWb5d1l1A3mJmZhwGLAZOAhJoCoYB+voL6qH+jhYST/oCRgA=="

      )
    ,
      scala.collection.immutable.Nil.::[
        scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext
          )
         => scala.quoted.Expr[Any]) | scala.quoted.Type[?]
      ](
        {
          {
            def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
              quoted.Type[String]
             = evidence$1
            closure($anonfun$2)
          }
        }
      ).::[
        scala.collection.immutable.Seq[Any] => ((given scala.quoted.QuoteContext
          )
         => scala.quoted.Expr[Any]) | scala.quoted.Type[?]
      ](
        {
          {
            def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
              (given quoted.QuoteContext) => quoted.Expr[M[String]]
             =
              {
                def $anonfun(given evidence$2: quoted.QuoteContext):
                  quoted.Expr[M[String]]
                 =
                  {
                    m
                  }
                closure($anonfun)
              }
            closure($anonfun$1)
          }
        }
      )
    )(
      {
        x$2
      }
    )
  } of class class dotty.tools.dotc.ast.Trees$DefDef # 1528
exception while typing @scala.annotation.internal.SourceFile("../pg/i7322/Macros_2.scala") final module

class Macros_2$package$() extends Object(), Serializable {
  private def writeReplace(): AnyRef =
    new scala.runtime.ModuleSerializationProxy(classOf[Macros_2$package.type])
  def h(m: quoted.Expr[M[String]])(given x$2: quoted.QuoteContext):
    quoted.Expr[Any]
   =
    {
      val evidence$1: quoted.Type[String] =
        scala.runtime.quoted.Unpickler.unpickleType$direct[String](
          scala.collection.immutable.Nil.::[String](

              "XKGrH5GAAB+NFPi9VAAAAOsA64QAAOoBhEFTVHMBhlN0cmluZwGEamF2YQGEbGFuZwKCgoMBiVBvc2l0aW9ucwG/L1VzZXJzL2FuYXRvbGlpL1Byb2plY3RzL2RvdHR5L2RvdHR5Ly4uL3BnL2k3MzIyL01hY3Jvc18yLnNjYWxhgIR1gTaEhYeGAOsA64SG"

          )
        , scala.collection.immutable.Nil)(x$2)
      scala.runtime.quoted.Unpickler.unpickleExpr$direct[Any](
        scala.collection.immutable.Nil.::[String](

            "XKGrH5GAAHmgaRPcQgAAneD27My4AAHuAYRBU1RzAYFmAYRqYXZhAYRsYW5nAoKCgwGGT2JqZWN0AoKEhT+CgYYBgSQBjGV2aWRlbmNlJDEkXwqDiIGJAYxxdW90ZVR5cGVUYWcBhlF1b3RlZBeBjAGFc2NhbGEBiGludGVybmFsAoKOjwGGPGluaXQ+AoKQjBeBkgKCk4s/gpGUAZBNYWNyb3NfMiRwYWNrYWdlF4GWAYc8ZW1wdHk+AYlQb3NpdGlvbnMBvy9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9pNzMyMi9NYWNyb3NfMS5zY2FsYYCrk6mMoHCHk4P/gYCDl4qkg/+BgRetjnWLUHWNNpCIhXCVVjOWb5d1l1A3mJmZhwGLAZOAhJoCoYB+voL6qH+jhYST/oCRgA=="

        )
      ,
        scala.collection.immutable.Nil.::[
          scala.collection.immutable.Seq[Any] => ((given
            scala.quoted.QuoteContext
          ) => scala.quoted.Expr[Any]) | scala.quoted.Type[?]
        ](
          {
            {
              def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
                quoted.Type[String]
               = evidence$1
              closure($anonfun$2)
            }
          }
        ).::[
          scala.collection.immutable.Seq[Any] => ((given
            scala.quoted.QuoteContext
          ) => scala.quoted.Expr[Any]) | scala.quoted.Type[?]
        ](
          {
            {
              def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
                (given quoted.QuoteContext) => quoted.Expr[M[String]]
               =
                {
                  def $anonfun(given evidence$2: quoted.QuoteContext):
                    quoted.Expr[M[String]]
                   =
                    {
                      m
                    }
                  closure($anonfun)
                }
              closure($anonfun$1)
            }
          }
        )
      )(
        {
          x$2
        }
      )
    }
} of class class dotty.tools.dotc.ast.Trees$TypeDef # 1530
exception while typing package <empty> {
  final lazy module val Macros_2$package: Macros_2$package$ =
    new Macros_2$package$()
  @scala.annotation.internal.SourceFile("../pg/i7322/Macros_2.scala") final
    module
   class Macros_2$package$() extends Object(), Serializable {
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Macros_2$package.type])
    def h(m: quoted.Expr[M[String]])(given x$2: quoted.QuoteContext):
      quoted.Expr[Any]
     =
      {
        val evidence$1: quoted.Type[String] =
          scala.runtime.quoted.Unpickler.unpickleType$direct[String](
            scala.collection.immutable.Nil.::[String](

                "XKGrH5GAAB+NFPi9VAAAAOsA64QAAOoBhEFTVHMBhlN0cmluZwGEamF2YQGEbGFuZwKCgoMBiVBvc2l0aW9ucwG/L1VzZXJzL2FuYXRvbGlpL1Byb2plY3RzL2RvdHR5L2RvdHR5Ly4uL3BnL2k3MzIyL01hY3Jvc18yLnNjYWxhgIR1gTaEhYeGAOsA64SG"

            )
          , scala.collection.immutable.Nil)(x$2)
        scala.runtime.quoted.Unpickler.unpickleExpr$direct[Any](
          scala.collection.immutable.Nil.::[String](

              "XKGrH5GAAHmgaRPcQgAAneD27My4AAHuAYRBU1RzAYFmAYRqYXZhAYRsYW5nAoKCgwGGT2JqZWN0AoKEhT+CgYYBgSQBjGV2aWRlbmNlJDEkXwqDiIGJAYxxdW90ZVR5cGVUYWcBhlF1b3RlZBeBjAGFc2NhbGEBiGludGVybmFsAoKOjwGGPGluaXQ+AoKQjBeBkgKCk4s/gpGUAZBNYWNyb3NfMiRwYWNrYWdlF4GWAYc8ZW1wdHk+AYlQb3NpdGlvbnMBvy9Vc2Vycy9hbmF0b2xpaS9Qcm9qZWN0cy9kb3R0eS9kb3R0eS8uLi9wZy9pNzMyMi9NYWNyb3NfMS5zY2FsYYCrk6mMoHCHk4P/gYCDl4qkg/+BgRetjnWLUHWNNpCIhXCVVjOWb5d1l1A3mJmZhwGLAZOAhJoCoYB+voL6qH+jhYST/oCRgA=="

          )
        ,
          scala.collection.immutable.Nil.::[
            scala.collection.immutable.Seq[Any] => ((given
              scala.quoted.QuoteContext
            ) => scala.quoted.Expr[Any]) | scala.quoted.Type[?]
          ](
            {
              {
                def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]):
                  quoted.Type[String]
                 = evidence$1
                closure($anonfun$2)
              }
            }
          ).::[
            scala.collection.immutable.Seq[Any] => ((given
              scala.quoted.QuoteContext
            ) => scala.quoted.Expr[Any]) | scala.quoted.Type[?]
          ](
            {
              {
                def $anonfun$1(x$0: scala.collection.immutable.Seq[Any]):
                  (given quoted.QuoteContext) => quoted.Expr[M[String]]
                 =
                  {
                    def $anonfun(given evidence$2: quoted.QuoteContext):
                      quoted.Expr[M[String]]
                     =
                      {
                        m
                      }
                    closure($anonfun)
                  }
                closure($anonfun$1)
              }
            }
          )
        )(
          {
            x$2
          }
        )
      }
  }
} of class class dotty.tools.dotc.ast.Trees$PackageDef # 1531
exception occurred while compiling ../pg/i7322/Macros_2.scala
java.lang.AssertionError: assertion failed: position not set for {
  def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]): quoted.Type[String]
     =
  evidence$1
  closure($anonfun$2)
} # 3204 of class dotty.tools.dotc.ast.Trees$Block in ../pg/i7322/Macros_1.scala while compiling ../pg/i7322/Macros_2.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: position not set for {
  def $anonfun$2(x$0: scala.collection.immutable.Seq[Any]): quoted.Type[String]
     =
  evidence$1
  closure($anonfun$2)
} # 3204 of class dotty.tools.dotc.ast.Trees$Block in ../pg/i7322/Macros_1.scala
  at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
  at dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:58)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2149)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1291)
  at dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:595)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2082)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2151)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.transform.Erasure$Typer.$anonfun$5(Erasure.scala:564)
  at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:110)
  at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:564)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2061)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.transform.Erasure$Typer.typedSelect(Erasure.scala:429)
  at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2041)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.transform.Erasure$Typer.typedTypeApply(Erasure.scala:530)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2079)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:548)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2061)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.transform.Erasure$Typer.$anonfun$5(Erasure.scala:564)
  at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:110)
  at dotty.tools.dotc.core.Decorators$ListDecorator$.zipWithConserve$extension(Decorators.scala:111)
  at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:564)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2061)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.transform.Erasure$Typer.typedApply(Erasure.scala:548)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2061)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2151)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedInlined(Typer.scala:1291)
  at dotty.tools.dotc.transform.Erasure$Typer.typedInlined(Erasure.scala:595)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2082)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:1600)
  at dotty.tools.dotc.transform.Erasure$Typer.typedDefDef(Erasure.scala:635)
  at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2048)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2184)
  at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2228)
  at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:747)
  at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1727)
  at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2051)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2116)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:2184)
  at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:2228)
  at dotty.tools.dotc.transform.Erasure$Typer.typedStats(Erasure.scala:747)
  at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1852)
  at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2092)
  at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2117)
  at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:123)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2153)
  at dotty.tools.dotc.typer.Typer.typed(Typer.scala:2165)
  at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:2241)
  at dotty.tools.dotc.transform.Erasure.run(Erasure.scala:100)
  at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:315)
  at scala.collection.immutable.List.map(List.scala:219)
  at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:316)
  at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:159)
  at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
  at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
  at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
  at dotty.tools.dotc.Run.runPhases$5(Run.scala:169)
  at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:177)
  at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
  at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
  at dotty.tools.dotc.Run.compileUnits(Run.scala:184)
  at dotty.tools.dotc.Run.compileSources(Run.scala:121)
  at dotty.tools.dotc.Run.compile(Run.scala:104)
  at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
  at dotty.tools.dotc.Driver.process(Driver.scala:178)
  at dotty.tools.dotc.Driver.process(Driver.scala:147)
  at dotty.tools.dotc.Driver.process(Driver.scala:159)
  at dotty.tools.dotc.Driver.main(Driver.scala:186)
  at dotty.tools.dotc.Main.main(Main.scala)
[error] Nonzero exit code returned from runner: 1
[error] (dotty-compiler-bootstrapped / Compile / runMain) Nonzero exit code returned from runner: 1
[error] Total time: 9 s, completed Sep 27, 2019 3:02:08 PM
sbt:dotty>

If you put the contents of Macros1.scala in Macros2.scala and compile only the latter, it will compile.

@milessabin
Copy link
Contributor

I'll bet you can reproduce that with a handwritten Mirror instance.

@anatoliykmetyuk
Copy link
Contributor Author

Could be, so far I haven't had any luck with it.

@anatoliykmetyuk
Copy link
Contributor Author

My reasoning behind blaming mirrors is that the error message says "assertion failed: position not set" and the knowledge that fromProduct is magic. But I haven't had a more detailed look yet.

@anatoliykmetyuk anatoliykmetyuk changed the title Mirrors unusable from quotes – compiler crashed when inlining Crash in macros during separate compilation Sep 27, 2019
@anatoliykmetyuk
Copy link
Contributor Author

You were right @milessabin, nothing to do with the mirrors. I've updated the initial post with a better-minimized example.

@anatoliykmetyuk anatoliykmetyuk self-assigned this Sep 27, 2019
@anatoliykmetyuk
Copy link
Contributor Author

anatoliykmetyuk commented Oct 10, 2019

Doesn't reproduce anymore. We should add a regression test when #7342 is fixed.

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 31, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 1, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 1, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 1, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 3, 2020
This Inlined node not was added as part of a fix for issue scala#3898.
It was an ad-hoc patch that ended up causing more issues than fixes and
therfore is removed.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Apr 3, 2020
This Inlined node not was added as part of a fix for issue scala#3898.
It was an ad-hoc patch that ended up causing more issues than fixes and
therfore is removed.
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

3 participants