Skip to content

Remove feature guard on lifetime dependence inference #76588

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

Merged

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Sep 19, 2024

Lifetime dependence inference runs on all function results that are ~Escapable. It was guarded by the NonEscapable feature flag. This PR removes the feature guard. This should theoretically be an NFC because ~Escapable types are flagged by Sema without the feature flag.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test macOS platform

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from 8c24e34 to 18c5322 Compare September 24, 2024 19:52
@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test macOS platform

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from 18c5322 to f02448b Compare September 24, 2024 22:35
@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test macOS platform

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

I only have a few comments on the changes to C++ interop.

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from 077ec17 to 32ca01d Compare September 26, 2024 19:47
@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch 2 times, most recently from cb0de0f to f07ab0b Compare September 26, 2024 23:07
Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

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

The C++ interop changes LGTM now, thanks!
I haven't reviewed the rest of the PR.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from f07ab0b to 47b7d6e Compare September 27, 2024 20:29
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch 2 times, most recently from 3555333 to f25e383 Compare October 22, 2024 20:34
Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

LGTM

@meg-gupta
Copy link
Contributor Author

@swift-ci test

1 similar comment
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from f25e383 to a9d317e Compare November 12, 2024 07:19
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from a9d317e to b28d8c9 Compare November 12, 2024 09:20
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from b28d8c9 to 055b153 Compare November 12, 2024 20:01
@meg-gupta
Copy link
Contributor Author

@swift-ci test

SwiftDeclSynthesizer::makeDefaultArgument does not create substituion map while
creating the implicit FuncDecl which leads to TypeChecker complaining about
the absence when there are type parameters. Avoid importing such C++ functions for now.
This PR introduces a `mapTypeIntoContext` in `InterfaceTypeRequest::evaluate` which introduces a cycle in this test.
We currently load it for prespecialization when it wasn't loaded initially.

This causes an inadvertant issue for invertible protocols.

When we don’t have the stdlib loaded initially, we “synthesize” the
invertible protocol from the Builtin module by creating a new `ProtocolDecl*`
and stashing it on the `ASTContext`.
If the stdlib gets loaded later, deserialized stdlib types conform to the deserialized `Escapable` protocol
which has a different `ProtocolDecl *` pointer for `Escapable`.
So queries like `conformsToInvertible` fail because they are using the wrong `ProtocolDecl*`
for `Copyable`/`Escapable` while looking up the ConformanceTable.
@meg-gupta meg-gupta force-pushed the lifetimeremovefeatureguardincompiler branch from 055b153 to cf4832e Compare November 12, 2024 20:05
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta meg-gupta merged commit 184058e into swiftlang:main Nov 13, 2024
5 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.

3 participants