Skip to content

[5.1][Diagnostics] Assignment diagnostic improvements #24988

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 22, 2019

  • Detect and diagnose conversion failures related to collection element types;
  • Improve contextual mismatch diagnostics for for ... in <expr> loop;
  • Extend use of missing protocol conformance fix to cover contextual failures, such as:
    • Assignment mismatches, where destination requires source to conform
      to certain protocol (or protocol composition);
    • Incorrect returns where returned type doesn't conform to the protocol specified in the signature.
    • Sequence element type mismatches in condition of for ... in loop.

Resolves: rdar://problem/49400007

xedin and others added 8 commits May 22, 2019 12:52
… collection element types

Detect and diagnose a contextual mismatch between expected
collection element type and the one provided (e.g. source
of the assignment or argument to a call) e.g.:

```swift
let _: [Int] = ["hello"]

func foo(_: [Int]) {}
foo(["hello"])
```

(cherry picked from commit b9a0ca6)
… protocol type

Switch type allows "missing conformance" diagnostic to be
used not only for protocols by for protocol compositions as well.

(cherry picked from commit ace86e8)
…al failures

Extend use of `missing protocol conformance` fix to cover contextual
failures, such as:

- Assignment mismatches, where destination requires source to conform
  to certain protocol (or protocol composition);
- Incorrect returns where returned type doesn't conform to the
  protocol specified in the signature.

(cherry picked from commit ada6ab5)
…chExistentialTypes`

(cherry picked from commit 17643a3)
…smatches related to protocols

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

xedin commented May 22, 2019

@swift-ci please test

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

2 participants