Skip to content

Conversation

@ilevkivskyi
Copy link
Member

Fixes #5454

This fixes few similar overload crash scenarios.

The idea is quite simple: previously during first phase of function analysis we only set the full name and added it to locals, while during the second phase we analysed the signature and the function body. This however doesn't work with overloads, since we want to collect all item types into a single Overloaded(...). What I propose is to just move analysis of signature and the initialisers to the first phase. IMO this is more logical (we just want to postpone the bodies), and is more close to runtime semantics (especially the initialisers that are evaluated immediately during function definition).

Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

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

This seems totally plausible, but I am not very familiar with this part of semantic analysis and so if you are nervous about the change you might want to wait for Jukka.

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

LGTM

@JukkaL JukkaL merged commit 324111d into python:master Aug 14, 2018
@ilevkivskyi ilevkivskyi deleted the fix-overload-crash branch August 14, 2018 16:43
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.

Overloaded functions at nested scopes are not analyzed, causing crashes

3 participants