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

transparent macro caller from private object access error #13477

Closed
soronpo opened this issue Sep 5, 2021 · 1 comment · Fixed by #13492
Closed

transparent macro caller from private object access error #13477

soronpo opened this issue Sep 5, 2021 · 1 comment · Fixed by #13492
Assignees
Milestone

Comments

@soronpo
Copy link
Contributor

soronpo commented Sep 5, 2021

When exporting a transparent inline macro caller method from a private object, there is an access error.
If the macro is not transparent, then there is no error. If there is no macro call (just transparent inline) there is no error.
Possibly related to the resolved issue #12948.

Compiler version

v3.1.0-RC1

Minimized code

Minimized project available at: https://github.com/soronpo/dottybug/tree/export_inline_access_err
mylib/Main.scala

package mylib
import scala.quoted.*

private object Main:
  transparent inline def d(): Unit =
    ${interpMacro}
  def interpMacro(using Quotes) : Expr[Unit] =
    import quotes.reflect.*
    '{}

export Main.d

Test.scala

import mylib.*
val x = d()

Output

[error] 2 |val x = d()
[error]   |        ^^^
[error]   |object Main cannot be accessed as a member of mylib from module class Test$package$.
[error] one error found

Expectation

No error.

@nicolasstucki
Copy link
Contributor

Minimization without exports

package mylib
import scala.quoted.*

private[mylib] object Main:
  transparent inline def d(): Unit = ${interpMacro}
  def interpMacro(using Quotes) : Expr[Unit] = '{}

transparent inline def f(): Unit = Main.d()
import mylib.*
val x = f()

@nicolasstucki nicolasstucki changed the title export transparent macro caller from private object access error ransparent macro caller from private object access error Sep 9, 2021
@nicolasstucki nicolasstucki changed the title ransparent macro caller from private object access error transparent macro caller from private object access error Sep 9, 2021
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Sep 9, 2021
olsdavis pushed a commit to olsdavis/dotty that referenced this issue Apr 4, 2022
@Kordyjan Kordyjan added this to the 3.1.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants