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

Macro with name on unexpected behaviour #7857

Open
coffeepots opened this issue May 21, 2018 · 4 comments
Open

Macro with name on unexpected behaviour #7857

coffeepots opened this issue May 21, 2018 · 4 comments
Labels

Comments

@coffeepots
Copy link
Contributor

Module A:

macro ona*(body: untyped): untyped =
  discard

macro on*(body: untyped): untyped =
  discard

Module B:

import modulea

ona:
  echo "a" # no problem

on:
  echo "b" # Error: expression 'echo ["b"]' has no type (or is ambiguous)

Changing the name of the macro from on fixes the problem.

@data-man
Copy link
Contributor

For off the same.

@arnetheduck
Copy link
Contributor

isn't this because

on* = true ## alias for ``true``
?

@Araq
Copy link
Member

Araq commented May 22, 2018

Yeah, but I wonder why overloading resolution picks up consts. :-)

@metagn
Copy link
Collaborator

metagn commented Aug 25, 2024

It finds system.on first then calls semIndirectOp which calls semOpAux which typechecks all the arguments.

Maybe other symbols should also call semDirectOp/semMagic the same way ambiguous type symbols do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants