-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Compile Time Constant Extraction] Extract Interpolated String Literals #74491
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 Interpolated String Literals #74491
Conversation
b6c2d47
to
c0295bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it might make sense to both store segments and interpolations together in a single array, as well as extract out any static information that may be available. Something like this:
"segments": [
{
"valueKind": "RawLiteral",
"value": "Start Interpolation with Member Reference: ",
},
{
"valueKind": "Runtime",
// Any interpolation information
"interpolatedSegment": "Internal.internalTitle",
"baseTypeName": "ExtractInterpolatedStringLiterals.Internal",
"mangledBaseTypeName": "33ExtractInterpolatedStringLiterals8InternalV",
"label": "internalTitle"
},
{
"valueKind": "RawLiteral",
"value": ". Followed By Function Call: ",
},
{
"valueKind": "FunctionCall",
// Any interpolation information
},
{
"valueKind": "RawLiteral",
"value": ". End with KeyPath: ",
},
{
"valueKind": "KeyPath",
"value:": "nested.foo", // new keypath type
// Any interpolation information
"interpolatedSegment": "Internal.internalTitle",
"baseTypeName": "ExtractInterpolatedStringLiterals.MyType",
"mangledBaseTypeName": "33ExtractInterpolatedStringLiterals6MyTypeV",
},
{
"valueKind": "RawLiteral",
"value": ".",
}
]
I think leveraging the current types might make this more adaptable to future changes,
c0295bf
to
ade3977
Compare
@jPaolantonio I changed this up to just call Input:
Output:
|
ade3977
to
62de52a
Compare
@swift-ci test |
62de52a
to
9820865
Compare
@swift-ci test |
Added support for extracting Interpolated String literals:
Example: