{"action":"opened","issue":{"url":"https://api.github.com/repos/scalameta/scalameta/issues/526","repository_url":"https://api.github.com/repos/scalameta/scalameta","labels_url":"https://api.github.com/repos/scalameta/scalameta/issues/526/labels{/name}","comments_url":"https://api.github.com/repos/scalameta/scalameta/issues/526/comments","events_url":"https://api.github.com/repos/scalameta/scalameta/issues/526/events","html_url":"https://github.com/scalameta/scalameta/issues/526","id":184841886,"number":526,"title":"Error: unsupported tree AssignOrNamedArg","user":{"login":"jhkuperus","id":1083734,"avatar_url":"https://avatars.githubusercontent.com/u/1083734?v=3","gravatar_id":"","url":"https://api.github.com/users/jhkuperus","html_url":"https://github.com/jhkuperus","followers_url":"https://api.github.com/users/jhkuperus/followers","following_url":"https://api.github.com/users/jhkuperus/following{/other_user}","gists_url":"https://api.github.com/users/jhkuperus/gists{/gist_id}","starred_url":"https://api.github.com/users/jhkuperus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhkuperus/subscriptions","organizations_url":"https://api.github.com/users/jhkuperus/orgs","repos_url":"https://api.github.com/users/jhkuperus/repos","events_url":"https://api.github.com/users/jhkuperus/events{/privacy}","received_events_url":"https://api.github.com/users/jhkuperus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-24T13:34:19Z","updated_at":"2016-10-24T13:34:19Z","closed_at":null,"body":"Hello,\r\n\r\nI've been trying to get some code generation done with Scalameta and ran into a problem in our project. The problem occurs when an inline macro is attempting to expand a piece of code with a named parameter.\r\n\r\nIt could be I'm missing something here. If that is the case, could you explain to me why this piece of code is failing?\r\n\r\nThis issue includes:\r\n\r\n- Full stacktrace\r\n- Minimal example of problem\r\n\r\nWe are using SBT 0.13.11 with Scala 2.11.8 and Scalameta Paradise plugin 3.0.0-M5.\r\n\r\n### Stacktrace\r\n\r\n```\r\nInternal error: unsupported tree AssignOrNamedArg(Ident(TermName(\"reason\")), Literal(Constant(\"just because\")))\r\n(AssignOrNamedArg) reason = \"just because\"\r\n(Apply) Breaker(reason = \"just because\")\r\n(Apply) println(Breaker(reason = \"just because\"))\r\n(Template) Template(List(), List(), val _ = _, Some(List(println(Breaker(reason = \"just because\")))))\r\n(ModuleDef) object BreakMe extends scala.AnyRef {\r\n  def <init>() = {\r\n    super.<init>();\r\n    ()\r\n  };\r\n  println(Breaker(reason = \"just because\"))\r\n}\r\norg.jetbrains.jps.incremental.scala.remote.ClientEventProcessor.process(ClientEventProcessor.scala:22)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$class.handle(RemoteResourceOwner.scala:47)\r\norg.jetbrains.plugins.scala.compiler.RemoteServerRunner.handle(RemoteServerRunner.scala:14)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1$$anonfun$apply$3.apply(RemoteResourceOwner.scala:30)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1$$anonfun$apply$3.apply(RemoteResourceOwner.scala:29)\r\norg.jetbrains.jps.incremental.scala.package$.using(package.scala:21)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1.apply(RemoteResourceOwner.scala:29)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1$$anonfun$apply$1.apply(RemoteResourceOwner.scala:25)\r\norg.jetbrains.jps.incremental.scala.package$.using(package.scala:21)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1.apply(RemoteResourceOwner.scala:25)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$$anonfun$send$1.apply(RemoteResourceOwner.scala:24)\r\norg.jetbrains.jps.incremental.scala.package$.using(package.scala:21)\r\norg.jetbrains.jps.incremental.scala.remote.RemoteResourceOwner$class.send(RemoteResourceOwner.scala:24)\r\norg.jetbrains.plugins.scala.compiler.RemoteServerRunner.send(RemoteServerRunner.scala:14)\r\norg.jetbrains.plugins.scala.compiler.RemoteServerRunner$$anon$1$$anonfun$run$1.apply$mcVI$sp(RemoteServerRunner.scala:33)\r\nscala.collection.immutable.Range.foreach$mVc$sp(Range.scala:166)\r\norg.jetbrains.plugins.scala.compiler.RemoteServerRunner$$anon$1.run(RemoteServerRunner.scala:30)\r\norg.jetbrains.plugins.scala.worksheet.server.RemoteServerConnector.compileAndRun(RemoteServerConnector.scala:85)\r\norg.jetbrains.plugins.scala.worksheet.processor.WorksheetCompiler$$anon$1.run(WorksheetCompiler.scala:78)\r\ncom.intellij.compiler.progress.CompilerTask.run(CompilerTask.java:196)\r\ncom.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:710)\r\ncom.intellij.openapi.progress.impl.CoreProgressManager$3.run(CoreProgressManager.java:179)\r\ncom.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:568)\r\ncom.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:519)\r\ncom.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)\r\ncom.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:164)\r\ncom.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:128)\r\ncom.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:309)\r\njava.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\njava.util.concurrent.FutureTask.run(FutureTask.java:266)\r\njava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\njava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\njava.lang.Thread.run(Thread.java:745)\r\n```\r\n\r\n### Minimal Example\r\n\r\nI've reproduced it with the simple Main-macro that goes around as an example.\r\n\r\n```scala\r\npackage org.scalarules.meta\r\n\r\nimport scala.annotation.{StaticAnnotation, compileTimeOnly}\r\nimport scala.meta._\r\n\r\n@compileTimeOnly(\"Macro not expanded\")\r\nclass MainMacro extends StaticAnnotation {\r\n  def meta[T](thunk: => T) = thunk\r\n\r\n  inline def apply(defn: Any): Any = meta {\r\n    defn match {\r\n      case q\"object $name { ..$stats }\" =>\r\n        val main = q\"def main(args: Array[String]): Unit = { ..$stats }\"\r\n        q\"object $name { $main }\"\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThe following worksheet will cause the above stacktrace to occur:\r\n\r\n```scala\r\nimport org.scalarules.meta.MainMacro\r\n\r\nimport scala.annotation.StaticAnnotation\r\nimport scala.meta._\r\n\r\ncase class Breaker(reason: String)\r\n\r\n@MainMacro\r\nobject BreakMe {\r\n  println(Breaker(reason = \"just because I can\"))\r\n}\r\n```"}}
{"actor":{"display_login":"jhkuperus"}}