-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 in class with private implementation from companion object #15413
Labels
Comments
prolativ
added
itype:bug
stat:needs info
area:metaprogramming:quotes
Issues related to quotes and splices
labels
Jun 9, 2022
The inline accessor sbt:scala3> scalac Main.scala -Xprint:typer
-- Error: Main.scala:6:28 ------------------------------------------------------
6 | inline def foo: Unit = ${ Macro.fooImpl }
| ^^^^^^^^^^^^^
| Malformed macro.
|
| Expected the splice ${...} to contain a single call to a static method.
[[syntax trees at end of typer]] // Main.scala
package <empty> {
import scala.quoted.*
class Macro() extends Object() {
def foo: Unit
final def inline$fooImpl(using x$1: quoted.Quotes): quoted.Expr[Unit] =
Macro.fooImpl(x$1)
}
final lazy module val Macro: Macro = new Macro()
final module class Macro() extends Object() { this: Macro.type =>
private[this] def fooImpl(using x$1: quoted.Quotes): quoted.Expr[Unit] = ???
}
} |
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 1, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 1, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 1, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 1, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 1, 2023
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 3, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static members, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backwards binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 3, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 3, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 6, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 7, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 7, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 7, 2023
If a class `C` needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in a new invisible module `C$inline$accessors`. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 21, 2023
If a class needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in the top-level class as a java static method. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 21, 2023
If a class needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in the top-level class as a java static method. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 21, 2023
If a class needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in the top-level class as a java static method. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 21, 2023
If a class needs inline accessors that would be added top-level or if the accessor is to a static member, we place it in the top-level class as a java static method. If the accessor location in the new scheme is not the same as the previous location, we also generate the old accessor for backward binary compatibility but do not use it. Fixes scala#13215 Fixes scala#15413
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 22, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 22, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 22, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 22, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 22, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 23, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 23, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 23, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Feb 23, 2023
Part of the fix for scala#15413 Part of the fix for scala#16983
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Aug 16, 2023
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 scala#15413
nicolasstucki
added a commit
that referenced
this issue
Aug 17, 2023
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
WojciechMazur
pushed a commit
that referenced
this issue
Jun 19, 2024
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]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.2.0-RC1-bin-20220607-76a0b29-NIGHTLY
Minimized code
Output
Expectation
This seems wrong to me although I'm not sure what the correct behaviour should be as I see two options:
Note that if the inline def is inside the object, everything compiles successfully:
The text was updated successfully, but these errors were encountered: