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

Make the names of declarations unusable before the point where their type is known. #1352

Merged

Conversation

zygoloid
Copy link
Contributor

@zygoloid zygoloid commented Jun 29, 2022

Following #875, diagnose any use of a name prior to the point where it is introduced and its type is known.

This works by performing name resolution on a top-level class, interface, or impl twice: the first pass performs name-resolution for everything other than nested function bodies, and the second pass performs name resolution on function bodies. At the moment, the second pass does a superset of the work done by the first pass, and as a consequence, some identifier expressions now have their target set twice to the same thing.

@zygoloid zygoloid added the explorer Action items related to Carbon explorer code label Jun 29, 2022
@zygoloid zygoloid requested a review from a team as a code owner June 29, 2022 23:26
explorer/interpreter/resolve_names.cpp Outdated Show resolved Hide resolved
explorer/interpreter/resolve_names.cpp Outdated Show resolved Hide resolved
explorer/interpreter/resolve_names.cpp Outdated Show resolved Hide resolved
explorer/interpreter/resolve_names.cpp Outdated Show resolved Hide resolved
explorer/ast/expression.h Show resolved Hide resolved
Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

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

Approving, with the note to please look at my comment re: "completely declared". But I don't want to keep blocking over the prhasing.

@zygoloid zygoloid merged commit 75d10e3 into carbon-language:trunk Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
explorer Action items related to Carbon explorer code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants