Skip to content

Conversation

@hamishknight
Copy link
Contributor

  • Turn BindExtensionsForIDEInspectionRequest into the main extension binding request.
  • Change ExtendedNominalRequest such that it's no longer what extension binding calls into to do the name lookup, instead it calls directly into computeExtendedNominal. getExtendedNominal can then be the entrypoint for ExtendedNominalRequest and assumes that extension binding has already run. This avoids needing to fake the dependency relationship in the DeclChecker.

@hamishknight
Copy link
Contributor Author

hamishknight commented Aug 17, 2025

@hamishknight
Copy link
Contributor Author

hamishknight commented Aug 17, 2025

@hamishknight
Copy link
Contributor Author

swiftlang/llvm-project#11189

@swift-ci please test

Copy link
Contributor

Choose a reason for hiding this comment

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

Can lldb evaluate the request too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I'm hoping so, the current call to computeExtendedNominal is buried within some code synthesis they're doing after parsing, I'm not yet sure where the best place would be to stick a call to the main request. In any case, I'd like to tackle that in a follow-up since I don't want it to block this PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I know it was like this before your PR, but do you mind moving IDEInspectionSecondPassRequest::evaluate() and Parser::performIDEInspectionSecondPassImpl() to lib/IDE? Feels like a layering violation for this to live here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Heh yeah, I wasn't too bothered about the layering violation here since this code will all change once we switch over to ASTGen. I think the rest of this logic being in libParse is sort of fine (at the very least, defining a Parser method outside of libParse seems like it would just be a different kind of layering violation), I think the better fix here would be sinking the call to bindExtensions into the callback code that's in libIDE, I can make that change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sunk the call to bindExtensions into libIDE. Hopefully we can also delete this when we requestify extension binding (last I checked there was a horrible request cycle though the clang importer)

I missed this in my previous patch that moved extension binding until
after we've mutated the AST for IDE inspection, this ad-hoc extension
binding logic is no longer necessary.
This will mainly be useful once extension binding is fully
requestified, but even now it's a good idea to ensure module loading
isn't kicking name lookup.
- Turn `BindExtensionsForIDEInspectionRequest` into the main extension
binding request.
- Change `ExtendedNominalRequest` such that it's no longer what
extension binding calls into to do the name lookup, instead it calls
directly into `computeExtendedNominal`. `getExtendedNominal` can
then be the entrypoint for `ExtendedNominalRequest` and assumes that
extension binding has already run. This avoids needing to fake the
dependency relationship in the DeclChecker.
This avoids the layering violation of calling `bindExtensions` from
parser code.
@hamishknight
Copy link
Contributor Author

swiftlang/llvm-project#11189

@swift-ci please smoke test

@hamishknight hamishknight merged commit f8218e3 into swiftlang:main Sep 10, 2025
3 checks passed
@hamishknight hamishknight deleted the ext-cleanup branch September 10, 2025 08:37
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.

2 participants