Skip to content
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

macro bundles don't work in REPL #7550

Closed
scabug opened this issue Jun 3, 2013 · 2 comments
Closed

macro bundles don't work in REPL #7550

scabug opened this issue Jun 3, 2013 · 2 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Jun 3, 2013

First of all, bundles defined in REPL currently can't be found by scala.reflect.macros.compiler.Resolvers, because when one writes "def foo = macro Bundle.impl", the MacroHandler.referencedNames set doesn't contain TypeName("Bundle"), hence Imports.importsCode fails to import Bundle when compiling the macro def.

However even if this issue is fixed, e.g. by defining "override lazy val referencedNames = ImportVarsTraverser(member).flatMap(name => List(name.toTermName, name.toTypeName))" in MacroHandler, we still got a problem with the fact that macro bundles can only be defined as top-level classes or traits.

@scabug
Copy link
Author

scabug commented Jun 3, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7550?orig=1
Reporter: @xeno-by
Affected Versions: 2.11.0-M4

@scabug
Copy link
Author

scabug commented Jun 3, 2013

@xeno-by said:
Here's a partest:

import scala.tools.partest.ReplTest

object Test extends ReplTest {
  def code = """
    import scala.language.experimental.macros
    import scala.reflect.macros.Macro
    trait Foo extends Macro { def foo(x: c.Expr[Int]) = x }
    def foo(x: Int) = macro Foo.foo
    foo(2)
  """
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants