Skip to content

[5.1][Diagnostics] Assorted diagnostics imporovements #24644

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

xedin
Copy link
Contributor

@xedin xedin commented May 9, 2019

Cherry-pick of recent diagnostic improvements landed on master:

  • Extraneous use of &
  • Extraneous returns from void functions
  • Missing explicit nullary calls in
    • assignments
    • assignments with contextual type
    • return statements
    • arguments

xedin added 4 commits May 9, 2019 13:03
Follow-up cleanup to simplify code related to diagnosing of
opaque return type conformance mismatches.

(cherry picked from commit 83d6f02)
Diagnose extraneous use of address of (`&`) which could only be
associated with arguments to `inout` parameters e.g.

```swift
struct S {}

var a: S = ...
var b: S = ...

a = &b
```

(cherry picked from commit 3af163a)
…unctions

Diagnose an attempt return something from a function which
doesn't have a return type specified e.g.

```swift
func foo() { return 42 }
```

(cherry picked from commit 4f63c4a)
Now covers following new areas (alongside simple assignments):

- Contextual type coercions:
  - In assignment e.g. `let _: X = foo`
  - In return type positions e.g. `func foo() -> A { return bar }`

- Argument-to-parameter applications (including @autoclosure)

(cherry picked from commit cb3252e)
@xedin
Copy link
Contributor Author

xedin commented May 9, 2019

@swift-ci please test

@xedin xedin merged commit fcd0a6d into swiftlang:swift-5.1-branch May 9, 2019
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.

1 participant