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

[Compile Time Constant Extraction] Extract KeyPath Expressions #73718

Merged
merged 1 commit into from
May 23, 2024

Conversation

venkatesh5789
Copy link
Contributor

Added support for extracting key path variables

Example:

public struct MyType {
    var foo: String
}

public struct KeyPaths {
    static let nestedVariable = \MyType.foo
}

@venkatesh5789 venkatesh5789 requested review from artemcm and jPaolantonio and removed request for xedin, slavapestov and hborla May 17, 2024 19:14
include/swift/AST/ConstTypeInfo.h Outdated Show resolved Hide resolved
include/swift/AST/ConstTypeInfo.h Show resolved Hide resolved
lib/ConstExtract/ConstExtract.cpp Outdated Show resolved Hide resolved
@venkatesh5789 venkatesh5789 force-pushed the keypath-extraction branch 3 times, most recently from bb646b8 to bde30ef Compare May 21, 2024 18:29
@artemcm
Copy link
Contributor

artemcm commented May 21, 2024

@swift-ci test

// CHECK-NEXT: "typeName": "ExtractKeyPaths.KeyPaths",
// CHECK-NEXT: "mangledTypeName": "15ExtractKeyPaths0bC0V",
// CHECK-NEXT: "kind": "struct",
// CHECK-NEXT: "file": "SOURCE_DIR/test/ConstExtraction/ExtractKeyPaths.swift",
Copy link
Contributor

Choose a reason for hiding this comment

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

To have these tests work on windows, I believe instead of / you need to specify {{/|\\}}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok changed that and restarted the tests.

@venkatesh5789
Copy link
Contributor Author

@swift-ci test

@venkatesh5789
Copy link
Contributor Author

@swift-ci test

@venkatesh5789 venkatesh5789 merged commit a0d62d9 into apple:main May 23, 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.

None yet

2 participants