mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The refactoring in #68760 accidentally caused us to start parsing skipped function bodies if they have parameters, as the local discriminator request kicks parsing through `getBody()`. Cherry-pick part of 47ff9568db749def08007b64a5425789cb514ac3 which was never landed, ensuring we don't call `getBody` for a skipped function body. This is meant to be a minimal low-risk change that fixes the issue in question, restoring the behavior we had in 5.10. Fixing the parser skipping behavior for `#sourceLocation` will be done in a follow-up. We also ought to see if there's a better way we can enforce that skipped function bodies don't end up getting parsed, for now I've added a test. rdar://131726797
22 lines
775 B
Swift
22 lines
775 B
Swift
// RUN: %empty-directory(%t/stats)
|
|
|
|
// RUN: %target-swift-frontend -emit-module -experimental-skip-non-inlinable-function-bodies-without-types -module-name Mod -emit-module-path %t/Mod.swiftmodule -stats-output-dir %t/stats %s
|
|
// RUN: %{python} %utils/process-stats-dir.py --set-csv-baseline %t/stats.csv %t/stats
|
|
// RUN: %FileCheck -input-file %t/stats.csv %s
|
|
|
|
// The printing implementation differs in asserts and no-asserts builds, it will
|
|
// either print `"Parse.NumFunctionsParsed" 0` or not print it at all. Make sure
|
|
// we don't output any non-zero value.
|
|
// CHECK-NOT: {{"Parse.NumFunctionsParsed" [^0]}}
|
|
|
|
// Make sure we skip parsing these bodies.
|
|
public func foo(x: Int, y: Int) {}
|
|
|
|
public func bar() {
|
|
func baz() {}
|
|
}
|
|
|
|
public struct S {
|
|
public func qux() {}
|
|
}
|