Skip to content

No import warning for scala 2 macros #9100

Closed
@bishabosha

Description

@bishabosha

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions