-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve non-static macro implementation error message
If non-static inline accessor is generated we do not we can tell the user why they cannot access the macro implementation this way. Currently we do not have a clean way to fix this code, but in the future [SIP-58](scala/improvement-proposals#58) would introduce a way to not generate this accessor. Fixes #15413 [Cherry-picked f1db208]
- Loading branch information
1 parent
feeddb7
commit 8dfbd6d
Showing
3 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- Error: tests/neg-macros/i15413.scala:4:22 --------------------------------------------------------------------------- | ||
4 | inline def foo = ${ Macro.fooImpl } // error | ||
| ^^^^^^^^^^^^^ | ||
| Macro implementation is not statically accessible. | ||
| | ||
| Non-static inline accessor was generated in class Macro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import scala.quoted.* | ||
|
||
class Macro: | ||
inline def foo = ${ Macro.fooImpl } // error | ||
|
||
object Macro: | ||
private def fooImpl(using Quotes) = '{} |