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

Using include with a module with a private macro exposes it #14578

Closed
sol-vin opened this issue May 8, 2024 · 2 comments
Closed

Using include with a module with a private macro exposes it #14578

sol-vin opened this issue May 8, 2024 · 2 comments

Comments

@sol-vin
Copy link
Contributor

sol-vin commented May 8, 2024

Issue:

Using include with a module that has a private macro exposes the macro publicly

Code:

module A
  private macro test(t)
    {% puts "HI #{t}" %}
  end
end

A.test(1)

include A

test(2)

throws an Error: private macro 'test' called for A

module A
  private macro test(t)
    {% puts "HI #{t}" %}
  end
end

include A

test(2)

Produces:

HI 2

What it should do:

Throw an Error: private macro 'test' called for A

@straight-shoota
Copy link
Member

straight-shoota commented May 8, 2024

This seems to work as expected. include A makes all features in A available in the parent namespace. A private macro is still visible from the same namespace, so it makes sense that you can call it after include A.

Note that the visibility of test does not change. Calling it from a different namespace is still prohibited.

module A
  private macro test(t)
    {% puts "HI #{t}" %}
  end
end

module B
  include A
  test(2)
end

B.test(3) # Error: private macro 'test' called for B

@sol-vin
Copy link
Contributor Author

sol-vin commented May 8, 2024

Ah, my bad, closed

@sol-vin sol-vin closed this as completed May 8, 2024
@Blacksmoke16 Blacksmoke16 closed this as not planned Won't fix, can't repro, duplicate, stale May 8, 2024
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

3 participants