Skip to content

Conversation

@slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Nov 12, 2025

The thing being mapped into and out of is GenericEnvironment, and not GenericContext (the latter exists, but it's a DeclContext subclass that's mostly internal to a few things in the AST). Let's rename these operations since "context" is already a highly overloaded term, and it's clearer if people talk about "mapping types into a generic environment", etc, since then we know exactly what is being referred to.

@slavapestov
Copy link
Contributor Author

swiftlang/llvm-project#11809
@swift-ci Please smoke test

Copy link
Member

@kavon kavon left a comment

Choose a reason for hiding this comment

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

This is a good idea.

…nment(), mapReplacementTypesOutOfContext() => subs.mapReplacementTypesOutOfEnvironment()
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>()) {
if (auto *FD = dyn_cast<FuncDecl>(AFD))
return FD->mapTypeIntoContext(FD->getResultInterfaceType());
return FD->mapTypeIntoEnvironment(FD->getResultInterfaceType());
Copy link
Contributor

Choose a reason for hiding this comment

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

@slavapestov is the generics book going to need another update? 😄 – but more seriously, what's the rename motivation? is 'context' too overloaded?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll upload a new version of chapters/archetypes.tex next time around. The motivation for the rename is that "context" is too overloaded, yeah. See the PR description

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, my bad – i think i saw the PR before it had a description 🙈

@slavapestov slavapestov force-pushed the rename-generic-environment-operations branch from 146b205 to 64f2d1a Compare November 12, 2025 19:52
@slavapestov
Copy link
Contributor Author

swiftlang/llvm-project#11809
@swift-ci Please smoke test

@slavapestov slavapestov merged commit e8004b7 into swiftlang:main Nov 13, 2025
3 checks passed
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.

5 participants