[ fix ] Ensure local defs with no claim are local #3017
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
PR #1952 introduced top level aliases - definitions without a type declaration. This had a number of side effects, including local function names being exposed at top level and strange type errors for local function definitions without type declarations.
It turns out that the root cause was the function names not being added to
nested
. This PR addresses that by looking atIDef
in addition toIClaim
when determining the list of locally defined names. It fixes #2782, #2592, and #2593, which are included in the test case. It also addresses a case raised on discord.I believe it addresses #3016, but note that, as with top level declarations, the definitions have to have simple bind variables on the LHS. (A constraint imposed by the #1952 code.)