Skip to content

[Compile Time Constant Extraction] Support for open existential expressions #83008

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

justin-s-kang
Copy link

@justin-s-kang justin-s-kang commented Jul 11, 2025

Adding support for extracting open existential expressions that may impact extraction for Swift 6

Resolves rdar://155634076

@@ -355,6 +355,19 @@ extractCompileTimeValue(Expr *expr, const DeclContext *declContext) {
}
}

if (functionKind == ExprKind::FunctionConversion) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please refactor the various places in this function that do:

      if (functionKind == ExprKind::DotSyntaxCall) {
        auto dotSyntaxCallExpr = cast<DotSyntaxCallExpr>(callExpr->getFn());

To instead do

      if (auto dotSyntaxCallExpr = dyn_cast<DotSyntaxCallExpr>(callExpr->getFn()) {

if (functionKind == ExprKind::FunctionConversion) {
auto functionConversionExpr = cast<FunctionConversionExpr>(callExpr->getFn());
if (functionConversionExpr->getSubExpr()->getKind() == ExprKind::DeclRef) {
auto declRefExpr = cast<DeclRefExpr>(functionConversionExpr->getSubExpr());
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@justin-s-kang
Copy link
Author

@swift-ci test

Copy link
Contributor

@slavapestov slavapestov left a comment

Choose a reason for hiding this comment

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

Much cleaner, thank you :)

@xedin
Copy link
Contributor

xedin commented Jul 14, 2025

@swift-ci please test macOS platform

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