-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fix #4564: indent closes implicit object #4570
Fix #4564: indent closes implicit object #4570
Conversation
After #4568 I’m wondering if all fixes like this should just go on |
Assuming all the tests still pass, this looks good to me. I think we should probably target |
@GeoffreyBooth sure, retargeted to |
But this is a pretty bad bug in 1 no? |
If it throws a compiler error, then by definition it isn’t. No one is relying on this bug for their current output, so there’s no 1.x code that needs this fix. |
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.
Nothing stands out in the code. If the tests passes and @helixbass has done this then I guess it’s fine.
Fixes #4564
The breaking example from that issue was:
The general case is when an implicit object is followed by an indent, eg this also breaks:
The solution was to make implicit objects act more like implicit calls as far as how they behave when they see an
INDENT
. Basically the exception to them behaving the same is when theINDENT
follows the:
of an object key (at which point clearly anINDENT
should not close the implicit object). Otherwise they should behave the same and this allows us to close multiple open implicit calls and/or implicit objects when we see anINDENT
(like in the first example)To make implicit objects act more like implicit calls, we need to push
CONTROL
s (ie suppressors ofINDENT
-closes-implicits behavior) onto thestack
not just when we're (immediately) inside an implicit call (ieinImplicitCall()
) but also when we're (immediately) inside an implicit object (ieinImplicitObject()
)This led to a slightly cleaner solution to handle things like
a: for x in y then x
than what @xixixao did in #3328. Basically if we see aFOR
right after a:
, we explicitly push aCONTROL
(rather than having a special case represented by@insideForDeclaration
that thwarts attemptedendImplicitObject()
s, that's whatCONTROL
is there to do). So I was able to get rid of all the@insideForDeclaration
stuff from that PR@GeoffreyBooth if this is deemed potentially-breaking I can retarget it to
2