Skip to content

Regex literal runtime plumbing. #40487

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
merged 1 commit into from
Dec 10, 2021
Merged

Conversation

rxwei
Copy link
Contributor

@rxwei rxwei commented Dec 9, 2021

  • Frontend: Implicitly import _StringProcessing when frontend flag -enable-experimental-string-processing is set.
  • Type checker: Set a regex literal expression's type as _StringProcessing.Regex<(Substring, DynamicCaptures)>. (Substring, DynamicCaptures) is a temporary Match type that will help get us to an end-to-end working system. This will be replaced by actual type inference based a regex's pattern in a follow-up patch (soon).
  • SILGen: Lower a regex literal expression to a call to _StringProcessing.Regex.init(_regexString:).
  • String processing runtime: Add Regex, DynamicCaptures (matching actual APIs in apple/swift-experimental-string-processing), and Regex(_regexString:).

Upcoming:

  • Build _MatchingEngine and _StringProcessing modules with sources from apple/swift-experimental-string-processing.
  • Replace DynamicCaptures with inferred capture types.

@rxwei rxwei requested a review from hamishknight December 9, 2021 17:52
@rxwei rxwei force-pushed the regex-integration-1 branch 2 times, most recently from 7e8c1ac to 42234e9 Compare December 9, 2021 18:14
@rxwei
Copy link
Contributor Author

rxwei commented Dec 9, 2021

@swift-ci please test

@rxwei rxwei force-pushed the regex-integration-1 branch 2 times, most recently from 4d540c3 to 4e376cf Compare December 9, 2021 20:53
@rxwei rxwei force-pushed the regex-integration-1 branch from 4e376cf to f6c3186 Compare December 9, 2021 21:21
Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM modulo the question on whether the REQUIRES: libswift is required for the test

@rxwei
Copy link
Contributor Author

rxwei commented Dec 9, 2021

@swift-ci please test

@rxwei
Copy link
Contributor Author

rxwei commented Dec 9, 2021

@swift-ci please test windows

- Frontend: Implicitly import `_StringProcessing` when frontend flag `-enable-experimental-string-processing` is set.
- Type checker: Set a regex literal expression's type as `_StringProcessing.Regex<(Substring, DynamicCaptures)>`. `(Substring, DynamicCaptures)` is a temporary `Match` type that will help get us to an end-to-end working system. This will be replaced by actual type inference based a regex's pattern in a follow-up patch (soon).
- SILGen: Lower a regex literal expression to a call to `_StringProcessing.Regex.init(_regexString:)`.
- String processing runtime: Add `Regex`, `DynamicCaptures` (matching actual APIs in apple/swift-experimental-string-processing), and `Regex(_regexString:)`.

Upcoming:
- Build `_MatchingEngine` and `_StringProcessing` modules with sources from apple/swift-experimental-string-processing.
- Replace `DynamicCaptures` with inferred capture types.
@rxwei rxwei force-pushed the regex-integration-1 branch from f6c3186 to 05363cd Compare December 10, 2021 00:05
@rxwei
Copy link
Contributor Author

rxwei commented Dec 10, 2021

@swift-ci please test and merge

@swift-ci swift-ci merged commit e2f1907 into swiftlang:main Dec 10, 2021
@etcwilde
Copy link
Member

This PR is causing Swift to fail to build on Windows:

\Users\swift-ci\jenkins\workspace\oss-swift-windows-x86_64-vs2019\swift\lib\SILGen\SILGenApply.cpp(1913): error C2668: 'swift::Lowering::PreparedArguments::PreparedArguments': ambiguous call to overloaded function
C:\Users\swift-ci\jenkins\workspace\oss-swift-windows-x86_64-vs2019\swift\lib\SILGen\ArgumentSource.h(307): note: could be 'swift::Lowering::PreparedArguments::PreparedArguments(swift::Lowering::PreparedArguments &&)'
C:\Users\swift-ci\jenkins\workspace\oss-swift-windows-x86_64-vs2019\swift\lib\SILGen\ArgumentSource.h(294): note: or       'swift::Lowering::PreparedArguments::PreparedArguments(llvm::ArrayRef<swift::AnyFunctionType::Param>)'
C:\Users\swift-ci\jenkins\workspace\oss-swift-windows-x86_64-vs2019\swift\lib\SILGen\SILGenApply.cpp(1913): note: while trying to match the argument list '(initializer list)'

https://ci-external.swift.org/view/Pull%20Request/job/swift-PR-windows/19118

rxwei added a commit to rxwei/swift that referenced this pull request Dec 10, 2021
DougGregor added a commit that referenced this pull request Dec 10, 2021
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.

5 participants