-
-
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
Error on method call syntax within a template #7085
Comments
this is a well known issue, many people already encounter it when using generics. no wonder it also affected templates. template baz*(a: string): string =
mixin foo
var b = a.foo()
b but it would be nice if the compiler can activate the mixin automatically inside template and generics without specifically typing it (like C++ template). |
@jangko except now # Module B
import A
proc foo(a: string): string =
return "bye"
echo baz("hello")
# bye |
Old issue, but an answer was never given, it's |
@hlaaftana Using bind instead of mixin throws the same error. |
My bad, I was talking out of my ass, it doesn't fix these issues. No one mentioned |
* fix dot calls with resolved symbols in templates * make old code work * fix custom number literals test * remove leftover debug marker * enable "bug 9" test too * fix renderer, add test for #7085
* fix dot calls with resolved symbols in templates * make old code work * fix custom number literals test * remove leftover debug marker * enable "bug 9" test too * fix renderer, add test for nim-lang#7085
Following code doesn't work:
Works replacing the method call by a regular proc call. Also works as is when using the template within module A. Also works when exporting
foo
. I can only guess the compiler tries to resolve the method call too late. The method call limitations section of the manual does not mention this specific case.The text was updated successfully, but these errors were encountered: