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
[Parse] Eliminate backtracking in collection expression parsing #21487
Conversation
@swift-ci Please smoke test |
@@ -1,7 +1,7 @@ | |||
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -profile-generate -profile-coverage-mapping -emit-sil -module-name coverage_closures %s | %FileCheck %s | |||
|
|||
func bar(arr: [(Int32) -> Int32]) { | |||
// CHECK-LABEL: sil_coverage_map {{.*}}// closure #2 (Swift.Int32) -> Swift.Int32 in coverage_closures.bar | |||
// CHECK-LABEL: sil_coverage_map {{.*}}// closure #1 (Swift.Int32) -> Swift.Int32 in coverage_closures.bar |
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.
Previously, local discriminator #1
used to be consumed during backtracking.
Cool, I wonder if your PR fixes this bug too: https://github.com/apple/swift/pull/15619/files#diff-1a9565d4ad49da3f2dcb708fa95d21a3 |
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.
LGTM, Thanks for fixing this!
Parsing collection literal expression used to take exponential time depending on the nesting level of the first element. Stop using 'parseList()' because using it complicates libSyntax parsing. rdar://problem/45221238 / https://bugs.swift.org/browse/SR-9220 rdar://problem/38913395 / https://bugs.swift.org/browse/SR-7283
9cdad2c
to
22652f9
Compare
@slavapestov Yes this PR fixes that. Thank you for the link. I added a test case from #15619 . |
@swift-ci Please smoke test |
Parsing collection literal expression used to take exponential time depending on the nesting level of the first element.
Stop using
parseList()
because using it complicates libSyntax parsing.SR-9220 / rdar://problem/45221238
SR-7283 / rdar://problem/38913395