File tree Expand file tree Collapse file tree 3 files changed +35
-7
lines changed Expand file tree Collapse file tree 3 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -1538,10 +1538,22 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
1538
1538
opts |= ParsingFlags::SuppressWarnings;
1539
1539
}
1540
1540
1541
- // Turn off round-trip checking for secondary files, and for dependency
1542
- // scanning and IDE inspection.
1541
+ // Turn off new parser round-trip and diagnostics checking for
1542
+ // - secondary files
1543
+ // - Only want to verify on primary files, no point checking more than
1544
+ // once
1545
+ // - IDE inspection
1546
+ // - We don't want to pay the cost of verification for simple IDE
1547
+ // functionality (eg. completion and cursor info)
1548
+ // - dependency scanning
1549
+ // - Same as IDE inspection, this is meant to be a very fast operation.
1550
+ // Don't slow it down
1551
+ // - skipped function bodies
1552
+ // - Swift parser doesn't support function body skipping yet, so this
1553
+ // would result in verification failures when bodies have errors
1543
1554
if (!isEffectivelyPrimary || SourceMgr.hasIDEInspectionTargetBuffer () ||
1544
- frontendOpts.RequestedAction == ActionType::ScanDependencies) {
1555
+ frontendOpts.RequestedAction == ActionType::ScanDependencies ||
1556
+ typeOpts.SkipFunctionBodies != FunctionBodySkipping::None) {
1545
1557
opts -= ParsingFlags::RoundTrip;
1546
1558
opts -= ParsingFlags::ValidateNewParserDiagnostics;
1547
1559
}
Original file line number Diff line number Diff line change 1
- // RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserDiagnostics
2
-
3
- // FIXME: Swift parser is not enabled on Linux CI yet.
4
- // REQUIRES: OS=macosx
1
+ // REQUIRES: swift_swift_parser
5
2
// REQUIRES: asserts
6
3
4
+ // RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserDiagnostics
5
+
7
6
_ = [ ( Int ) -> async throws Int] ( )
8
7
// expected-error@-1{{'async throws' must precede '->'}}
9
8
// expected-note@-2{{move 'async throws' in front of '->'}}{{15-21=}} {{21-28=}} {{20-21= }} {{12-12=async }} {{12-12=throws }}
Original file line number Diff line number Diff line change
1
+ // REQUIRES: swift_swift_parser
2
+ // REQUIRES: asserts
3
+
4
+ // Checks that skipping function bodies doesn't cause the new parser validation
5
+ // to fail. This can currently be the case because the new parser doesn't
6
+ // support skipping, causing validation fail as it generates diagnostics when
7
+ // the C++ parser would not.
8
+
9
+ // RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserValidation
10
+ // RUN: %target-swift-frontend -typecheck %s -enable-experimental-feature ParserValidation -experimental-skip-all-function-bodies
11
+
12
+ func bad( ) {
13
+ _ = [ ( Int ) -> async throws Int] ( )
14
+ // expected-error@-1{{'throws' may only occur before '->'}}
15
+ // expected-error@-2{{'async' may only occur before '->'}}
16
+ }
17
+
You can’t perform that action at this time.
0 commit comments