File tree 3 files changed +35
-7
lines changed 3 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -1405,10 +1405,22 @@ CompilerInstance::getSourceFileParsingOptions(bool forPrimary) const {
1405
1405
opts |= ParsingFlags::SuppressWarnings;
1406
1406
}
1407
1407
1408
- // Turn off round-trip checking for secondary files, and for dependency
1409
- // scanning and IDE inspection.
1408
+ // Turn off new parser round-trip and diagnostics checking for
1409
+ // - secondary files
1410
+ // - Only want to verify on primary files, no point checking more than
1411
+ // once
1412
+ // - IDE inspection
1413
+ // - We don't want to pay the cost of verification for simple IDE
1414
+ // functionality (eg. completion and cursor info)
1415
+ // - dependency scanning
1416
+ // - Same as IDE inspection, this is meant to be a very fast operation.
1417
+ // Don't slow it down
1418
+ // - skipped function bodies
1419
+ // - Swift parser doesn't support function body skipping yet, so this
1420
+ // would result in verification failures when bodies have errors
1410
1421
if (!isEffectivelyPrimary || SourceMgr.hasIDEInspectionTargetBuffer () ||
1411
- frontendOpts.RequestedAction == ActionType::ScanDependencies) {
1422
+ frontendOpts.RequestedAction == ActionType::ScanDependencies ||
1423
+ typeOpts.SkipFunctionBodies != FunctionBodySkipping::None) {
1412
1424
opts -= ParsingFlags::RoundTrip;
1413
1425
opts -= ParsingFlags::ValidateNewParserDiagnostics;
1414
1426
}
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 preceed '->'}}
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