Skip to content

[5.1][TypeChecker] Improve contextual mismatch diagnostics for key path #24328

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

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Apr 26, 2019

Detect situations where key path doesn't have capability required
by the context e.g. read-only vs. writable, or either root or value
types are incorrect e.g.

struct S { let foo: Int }
let _: WritableKeyPath<S, Int> = \.foo

Here context requires a writable key path but foo property is
read-only.

(cherry picked from commit 94977ee)

Detect situations where key path doesn't have capability required
by the context e.g. read-only vs. writable, or either root or value
types are incorrect e.g.

```swift
struct S { let foo: Int }
let _: WritableKeyPath<S, Int> = \.foo
```

Here context requires a writable key path but `foo` property is
read-only.

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

xedin commented Apr 26, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ea0fb6e

@xedin
Copy link
Contributor Author

xedin commented Apr 27, 2019

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ea0fb6e

@xedin
Copy link
Contributor Author

xedin commented Apr 27, 2019

Not my lucky day today...

@xedin
Copy link
Contributor Author

xedin commented Apr 27, 2019

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - ea0fb6e

@xedin
Copy link
Contributor Author

xedin commented Apr 27, 2019

@swift-ci please test Linux platform

@xedin xedin merged commit 8d514ba into swiftlang:swift-5.1-branch Apr 29, 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