Skip to content

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Oct 17, 2019

This PR completely eliminates the need for FailureDiagnosis::visitKeyPathExpr
by handling contextual mismatches as well as e.g. missing/invalid members via
new diagnostic framework.

xedin added 3 commits October 17, 2019 12:55
Key path components can reference an invalid or missing member
just like regular expressions, so we need to account for that
while trying to simplify key path constraint.
@xedin xedin requested a review from hborla October 17, 2019 20:55
@xedin
Copy link
Contributor Author

xedin commented Oct 17, 2019

@swift-ci please smoke test

@@ -229,7 +230,9 @@ func testDisembodiedStringInterpolation(x: Int) {

func testNoComponents() {
let _: KeyPath<A, A> = \A // expected-error{{must have at least one component}}
// FIXME(diagnostics): This should be diagnosed as `missing generic parameter 'T'` instead of a contextual failure.
let _: KeyPath<C, A> = \C // expected-error{{must have at least one component}} expected-error{{}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hborla This is something that #27443 would helpfully address 🤞

@xedin
Copy link
Contributor Author

xedin commented Oct 17, 2019

@swift-ci please smoke test

@xedin xedin merged commit 14d9011 into swiftlang:master Oct 18, 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