-
-
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
[WIP] Early evaluation of mIs #8723
Conversation
The `evalIs` implementation was just a broken copy of `isOpImpl` so let's just avoid it alltogether: `mIs` nodes are either resolved during the semantic phase or bust.
compiler/semexprs.nim
Outdated
@@ -409,8 +409,10 @@ proc semIs(c: PContext, n: PNode, flags: TExprFlags): PNode = | |||
else: | |||
if lhsType.base.kind == tyNone: | |||
# this is a typedesc variable, leave for evals | |||
debug lhsType |
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.
oops
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 was intentional, in case the CI run triggered this code path. I'll just remove this branch.
result = evalIs(n, lhs.sym, g) | ||
# The only kind of mIs node that comes here is one depending on some | ||
# generic parameter and that's (hopefully) handled at instantiation time | ||
discard |
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.
You can go further and add an internalAssert false
here, but it might be wiser to do this after the 0.19 release.
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.
I'm thinking of something like this as a safety net:
internalAssert g.config, n[1].typ.base.containsGenericType
Edit: scrap that, we can't do much here since the semFold may be invoked at different times (see tactors
test)
Looks good to me too but what are the risks it breaks something? I think it's safer to apply this after 0.19 is out. |
* Early evaluation of mIs The `evalIs` implementation was just a broken copy of `isOpImpl` so let's just avoid it alltogether: `mIs` nodes are either resolved during the semantic phase or bust. * Remove dead code and tidy it up
* Early evaluation of mIs The `evalIs` implementation was just a broken copy of `isOpImpl` so let's just avoid it alltogether: `mIs` nodes are either resolved during the semantic phase or bust. * Remove dead code and tidy it up
CC @zah
evalIs
is dead and nobody will shed a single tearinGenericContext
makes sure we either resolve this expression here if possible or we resolve it after the generic instantation phase.lhsType.base.kind == tyNone
path to triggertisopr