Skip to content

[test] Update PD5LoadingTests.swift for an upcoming parser fix that suppressed a diagnostic it was checking for. #2654

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

Merged

Conversation

nathawes
Copy link

@nathawes nathawes commented Mar 11, 2020

The test parses the code below and checks for a expected ')' in expression list diagnostic:

import PackageDescription

let package = Package(
    name: "Trivial",
    targets: [
        .target(
            name: "foo",
            dependencies: []),
)

Prior to the parser fix the invalid targets array literal failed to parse but the error status wasn't propagated up to the containing argument list parsing code, so it produced an additional (and undesirable) missing right token diagnostic that this test was checking for.

/tmp/t.swift:9:1: error: expected expression in container literal
)
^
/tmp/t.swift:9:2: error: expected ')' in expression list
)
 ^
/tmp/t.swift:2:22: note: to match this opening '('
let package = Package(
                     ^

After the parser fix in swiftlang/swift#30187 lands, we will only report the first error and suppress the rest:

/tmp/t.swift:9:1: error: expected expression in container literal
)
^

So this PR changes the test to check for that diagnostic instead.

…a diagnostic it was checking for.

The test parses the code below and checks for a "expected ')' in expression
list" diagnostic:

```
import PackageDescription

let package = Package(
    name: "Trivial",
    targets: [
        .target(
            name: "foo",
            dependencies: []),
)
```
Prior to the parser fix the invalid collection literal failed to parse but the
error status wasn't propagated up to the containing argument list parsing code,
so it produced an additional (and undesirable) missing right token diagnostic
that this test was checking for.

/tmp/t.swift:9:1: error: expected expression in container literal
)
^
/tmp/t.swift:9:2: error: expected ')' in expression list
)
 ^
/tmp/t.swift:2:22: note: to match this opening '('
let package = Package(
                     ^
Afer the parser fix in swiftlang/swift#30187, we only
report the first container literal error and suppress the rest:

/tmp/t.swift:9:1: error: expected expression in container literal
)
^
@nathawes
Copy link
Author

@swift-ci smoke test

@nathawes nathawes marked this pull request as ready for review March 12, 2020 05:12
@nathawes nathawes merged commit 75916ca into swiftlang:master Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants