Skip to content

No import warning for scala 2 macros #9100

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
bishabosha opened this issue Jun 3, 2020 · 0 comments
Closed

No import warning for scala 2 macros #9100

bishabosha opened this issue Jun 3, 2020 · 0 comments
Assignees

Comments

@bishabosha
Copy link
Member

Minimized code

object FooMacros {
  def foo: String = macro Foo.fooImpl[T]
}

Output

-- [E006] Not Found Error: FooMacros.scala:2:26 
2 |  def foo: String = macro Foo.fooImpl[T]
  |                          ^^^
  |                          Not found: Foo

longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: FooMacros.scala:2:38 
2 |  def foo: String = macro Foo.fooImpl[T]
  |                                      ^
  |                                      Not found: type T

Expectation

This is what you get in Scala 2 at typer

FooMacros.scala:2: error: macro definition needs to be enabled
by making the implicit value scala.language.experimental.macros visible.
This can be achieved by adding the import clause 'import scala.language.experimental.macros'
or by setting the compiler option -language:experimental.macros.
See the Scaladoc for value scala.language.experimental.macros for a discussion
why the feature needs to be explicitly enabled.
  def foo: String = macro Foo.fooImpl[T]
      ^
1 error
@nicolasstucki nicolasstucki self-assigned this Jun 8, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 8, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 8, 2020
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jun 8, 2020
nicolasstucki added a commit that referenced this issue Jun 8, 2020
Fix #9100: Add error when experimental macros are not enabled
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

2 participants