-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[Regex] Infer capture types of regex literals. #40630
Conversation
138ff1d
to
b8fcd62
Compare
b8fcd62
to
1721e43
Compare
Build failed |
swiftlang/swift-experimental-string-processing#92 @swift-ci please test linux |
swiftlang/swift-experimental-string-processing#92 @swift-ci please test windows |
Build failed |
CI didn't seem to like the nonexistent |
swiftlang/swift-experimental-string-processing#92 @swift-ci please test linux |
Build failed |
swiftlang/swift-experimental-string-processing#92 @swift-ci please clean test linux |
Build failed |
swiftlang/swift-experimental-string-processing#92 @swift-ci please test macos |
Build failed |
a0eafe2
to
780b5d6
Compare
When parsing a regular expression literal, accept a serialized capture structure from the regex parser. During type checking, decode it and form Swift types. Examples: ```swift '/(.)(.)/' // ==> `Regex<(Substring, Substring)>` '/(?<label>.)(.)/' // ==> `Regex<(label: Substring, Substring)` '/((.))*((.)?)/' //==> `Regex<([Substring], [Substring], Substring, Substring?)>` ``` Also: - Fix a bug where a regex literal parsing error is not returning an error parser result. Note: - This needs to land after swiftlang/swift-experimental-string-processing#92 and after `dev/4` tag has been created. - See swiftlang/swift-experimental-string-processing#92 for regex parser changes and the capture structure encoding. - The `RegexLiteralParsingFn` `CaptureStructureOut` pointer type change from `char *` to `void *` will not break builds due to implicit pointer conversion (SE-0324) and unchanged ABI. Resolves rdar://83253511.
780b5d6
to
1b3c0b7
Compare
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
When parsing a regular expression literal, accept a serialized capture structure from the regex parser. During type checking, decode it and form Swift types.
Examples:
Also:
Note:
dev/4
tag has been created.RegexLiteralParsingFn
CaptureStructureOut
pointer type change fromchar *
tovoid *
will not break builds due to implicit pointer conversion (SE-0324) and unchanged ABI.Resolves rdar://83253511.