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

[SR-1560] Implement support for SE-0075: Adding a Build Configuration Import Test #44169

Closed
lattner mannequin opened this issue May 19, 2016 · 7 comments
Closed

[SR-1560] Implement support for SE-0075: Adding a Build Configuration Import Test #44169

lattner mannequin opened this issue May 19, 2016 · 7 comments
Assignees
Labels
compiler The Swift compiler in itself feature A feature request or implementation swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented

Comments

@lattner
Copy link
Mannequin

lattner mannequin commented May 19, 2016

Previous ID SR-1560
Radar rdar://problem/27382987
Original Reporter @lattner
Type New Feature
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 3
Component/s Compiler
Labels New Feature
Assignee @CodaFi
Priority Medium

md5: 04d04fe990aa65b2fa375f915f803045

relates to:

  • SR-3438 Preprocessor directive not working when shadowing parameters

Issue Description:

"SE-0075: Adding a Build Configuration Import Test" has been accepted, an implementation would be great.

@belkadan
Copy link
Contributor

Concerns about implementation, for anyone taking this on:

1. Currently, all #if directives are resolved while parsing code, while import decls are resolved right at the start of "type-checking" (semantic analysis) in a step called "name-binding". (The name is a bit outdated, but the function is still called performNameBinding IIRC.

2. Parsing must not resolve imports, because we use parsing to do simple and fast syntax highlighting that should be useful even in the presence of source errors.

I think this means the best approach is allowing #if blocks to be unresolved after parsing and resolve them in the performNameBinding step. A possible refinement would postpone resolving #if blocks inside function and closure bodies until the function or closure was type-checked; at that point it would become a pre-processing pass when type-checking a function body.

@CodaFi
Copy link
Member

CodaFi commented Nov 13, 2016

Implementation so far is here (master...CodaFi:fine-imported-goods). Down to just some failing IDE tests!

@karwa
Copy link
Collaborator

karwa commented Jun 13, 2017

Is this still a candidate for Swift 4?

@belkadan
Copy link
Contributor

No one was able to spend more time on it since Robert's initial implementation was found to be flawed. At this point that means it probably won't make Swift 4 either.

@CodaFi
Copy link
Member

CodaFi commented Jun 13, 2017

@rintaro Is making good progress with the refactoring around this. The hardest part here is going to be lazier evaluation of conditions and rebinding declrefs that are shadowed by the introduction of variables in a condition. The latter problem could be solved by removing inner decl refs from the scope map and, when we evaluate the condition, run a walker that rebinds just those decl refs in our scope. It would have to be done in Sema, before or during the initial phase of type checking

@CodaFi
Copy link
Member

CodaFi commented Aug 25, 2017

After speaking with Ben, we came up with a compromise. See #11613

@CodaFi
Copy link
Member

CodaFi commented Aug 31, 2017

Resolved by the merger of the previously linked pull request.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added feature A feature request or implementation swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented and removed new feature labels Nov 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself feature A feature request or implementation swift evolution implemented Flag → feature: A feature that was approved through the Swift evolution process and implemented
Projects
None yet
Development

No branches or pull requests

4 participants