File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -415,7 +415,8 @@ unsigned LocalDiscriminatorsRequest::evaluate(
415415 ParameterList *params = nullptr ;
416416 ParamDecl *selfParam = nullptr ;
417417 if (auto func = dyn_cast<AbstractFunctionDecl>(dc)) {
418- node = func->getBody ();
418+ if (!func->isBodySkipped ())
419+ node = func->getBody ();
419420 selfParam = func->getImplicitSelfDecl ();
420421 params = func->getParameters ();
421422
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t/stats)
2+
3+ // 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
4+ // RUN: %{python} %utils/process-stats-dir.py --set-csv-baseline %t/stats.csv %t/stats
5+ // RUN: %FileCheck -input-file %t/stats.csv %s
6+
7+ // The printing implementation differs in asserts and no-asserts builds, it will
8+ // either print `"Parse.NumFunctionsParsed" 0` or not print it at all. Make sure
9+ // we don't output any non-zero value.
10+ // CHECK-NOT: {{"Parse.NumFunctionsParsed" [^0]}}
11+
12+ // Make sure we skip parsing these bodies.
13+ public func foo( x: Int , y: Int ) { }
14+
15+ public func bar( ) {
16+ func baz( ) { }
17+ }
18+
19+ public struct S {
20+ public func qux( ) { }
21+ }
Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+
3+ // Make sure we can parse with and without skipping.
4+ // RUN: %target-typecheck-verify-swift
5+ // RUN: not %target-swift-frontend -emit-module -experimental-skip-non-inlinable-function-bodies -module-name Mod -emit-module-path %t/Mod.swiftmodule -diagnostic-style=llvm %s 2>&1 | %FileCheck %s
6+
7+ // https://github.com/swiftlang/swift/issues/74561
8+ // Make sure we can parse this.
9+ #sourceLocation(file: "A", line: 3)
10+ public func foo( _ param: Int ) {
11+ #sourceLocation()
12+ }
13+
14+ // FIXME: This should parse correctly.
15+ #sourceLocation(file: "B", line: 3)
16+ @inlinable
17+ public func bar( _ param: Int ) {
18+ #sourceLocation()
19+ }
20+ // CHECK: B:6:1: error: parameterless closing #sourceLocation() directive without prior opening #sourceLocation(file:,line:) directive
You can’t perform that action at this time.
0 commit comments