-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Symbol resolution bug when template that uses method call syntax is used from another module #11733
Comments
This has been a long standing issue, probably since forever:
Given the details you gave, maybe we should close the other issue in favor of this one? cc @nitely. |
I'll see if I can replicate the more complex issue I hinted at, where wrapping the template in a public function doesn't do the trick and you MUST use the function syntax for stuff to compile again. |
#7223 should also be mentioned with the others, similar issue |
closes nim-lang#7223, closes nim-lang#11733, were fixed by nim-lang#22076
add test to close nim-lang#7223, close nim-lang#11733 closes nim-lang#7223, closes nim-lang#11733, were fixed by nim-lang#22076
When a template that uses the method call syntax is called from another module, there is a compilation error saying that the referenced method could not be found. If the call is rewritten using the regular function call syntax (object in the first argument), the error goes away.
Example
main.nim
submodule.nim
Current Output
nim c -r main.nim
Note that all cases work correctly when called from a single file, which is expected and good:
nim c -r submodule.nim
Note when the templates are referenced from another module, using the template directly that uses the method call syntax fails at compilation time. When the template is rewritten to use the function call syntax, using the template from another module works again. Interestingly, calling a public method that wraps the private template that uses the method call syntax works usually too (but not always, see comment below).
So to summarise, when calling the templates from another module:
It seems a bit complicated but the descriptions and the code should make the issue clear.
There are even more complicated cases when the wrapper function approach doesn't work (couldn't isolate that one, sorry), in that case the only workaround is to use the function call syntax in the template.
Expected Output
Calling the public functions/templates should behave the exact same way, regardless whether they are called from the same module or from another module.
Additional Information
The text was updated successfully, but these errors were encountered: