-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Treat untyped element in tuple and named tuple #6720
Treat untyped element in tuple and named tuple #6720
Conversation
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 don't think this is OK. What if some expressions inside the tuple are not untyped? Then, super should take care of handling untyped expressions. And then I can't see untyped expressions in the tests. I might give this a try and fix it.
Yes, there is no untyped expression in tests at least on cleanup phase after Maybe it is the simplest solution is moving |
And, the above I commented is very conservative way. |
I don't understand, why is there a "Nil assertion failed"? Because |
Yes, looks like it. |
Yes, |
I see. Well, we have two solutions:
I much prefer the second option. It makes the code more robust (we don't need to remember to assign @makenowjust Would you like to do 2, or do you want me to do that? |
@asterite Removing And it seems you are sure |
@makenowjust Ah, right, I forgot about the empty case. Then yeah, let's set |
🏓 |
I'm a bit lost on how this should proceed... Who needs to take what action? |
Fixed crystal-lang#6718 The reason of crystal-lang#6718 is calling `node.update` with untyped `TupleLiteral` or `NamedTupleLiteral`. An untyped node has no `node.program`, so it fails nil assertion. I think this `node.update` is not needed because `CleanupTransformer` does not change the type of `node` execpt for untyped and unreachable node. However such nodes should be transformed to other node. In other words `node.update` does nothing in general. Thus, this replaces `node.update` with treating untyped element.
…`CleanupTransformer` And add assignment to `node.program` before it. crystal-lang#6720 (comment)
0e03875
to
879977a
Compare
Updated. |
def untyped(x = nil) | ||
end | ||
|
||
# To reproduce this bug, it is needed to the expression that is |
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.
FYI the correct english is "... it is needed to have an expression that is ..." and it reads even better as "... it is required to have an expression that is ..."
Thanks @makenowjust ! |
Fixed #6718
The reason of #6718 is calling
node.update
with untypedTupleLiteral
orNamedTupleLiteral
. An untyped node has nonode.program
, so it fails nil assertion.I think this
node.update
is not needed becauseCleanupTransformer
does not change the type ofnode
except for untyped and unreachable node. However such nodes should be transformed to other node. In other wordsnode.update
does nothing in general.Thus, this replaces
node.update
with treating untyped element.