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

[WIP] Early evaluation of mIs #8723

Merged
merged 3 commits into from
Oct 14, 2018
Merged

Conversation

LemonBoy
Copy link
Contributor

CC @zah

  • evalIs is dead and nobody will shed a single tear
  • The check for inGenericContext makes sure we either resolve this expression here if possible or we resolve it after the generic instantation phase.
  • I couldn't get the lhsType.base.kind == tyNone path to trigger
  • We also fix (?) a test case in tisopr

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.
@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

Copy link
Contributor Author

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
Copy link
Member

@zah zah Aug 22, 2018

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.

Copy link
Contributor Author

@LemonBoy LemonBoy Aug 22, 2018

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)

@Araq
Copy link
Member

Araq commented Aug 23, 2018

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.

@Araq Araq merged commit 4808ef7 into nim-lang:devel Oct 14, 2018
krux02 pushed a commit to krux02/Nim that referenced this pull request Oct 15, 2018
* 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
narimiran pushed a commit to narimiran/Nim that referenced this pull request Oct 31, 2018
* 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
@timotheecour
Copy link
Member

this caused this regression #13066 @zah since you reviewed it :)

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

Successfully merging this pull request may close these issues.

4 participants