-
-
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
[TODO] fix #13524: magics with untyped params (eg astToStr) now work inside generics #13525
Conversation
timotheecour
commented
Feb 28, 2020
•
edited
Loading
edited
- fix astToStr doesn't work inside generics #13524: magics with untyped params (eg astToStr) now work inside generics
- if the tyUntyped trick i used isn't acceptable for some reason, I can simply change the logic to:
148818e
to
a507895
Compare
@@ -1629,7 +1629,7 @@ else: | |||
result[i+1] = y[i] | |||
|
|||
|
|||
proc astToStr*[T](x: T): string {.magic: "AstToStr", noSideEffect.} | |||
proc astToStr*(x: untyped): string {.magic: "AstToStr", noSideEffect.} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change though, for example, now astToStr(2 + 3)
produces something different. Arguably something better, but ... breaking change!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what you mean; both before and after PR I get:
echo 'echo astToStr(2+3)' | nim c -r -f -
2 + 3
(where the -f is needed until #13506 gets merged)
x is really untyped
, not typed, so the previous declaration didn't make sense (in particular, T
is meaningless); it only worked because of the way magics currently work, but hopefully one day this would be an error
Yes, please do that. |
14ea4be
to
090a418
Compare
closing in favor of #13681 |