Skip to content

[ConstraintSystem] Diagnose conditional requirement failures via fixes #22480

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
merged 5 commits into from
Feb 11, 2019

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Feb 8, 2019

Extend existing RequirementFailure functionality to support
conditional requirement failures. Such fixes are introduced
only if the parent type requirement has been matched successfully.

Resolves: rdar://problem/47871590

xedin added 3 commits February 7, 2019 13:51
Extend existing `RequirementFailure` functionality to support
conditional requirement failures. Such fixes are introduced
only if the parent type requirement has been matched successfully.

Resolves: rdar://problem/47871590
@xedin xedin requested a review from DougGregor February 8, 2019 19:37
@@ -338,7 +339,7 @@ extension Int: P { }

func testConditional(i: Int, s: String) {
let _: PArray<Int> = [i, i, i]
let _: PArray<String> = [s, s, s] // expected-error{{cannot convert value of type '[String]' to specified type 'PArray<String>'}}
let _: PArray<String> = [s, s, s] // expected-error{{generic struct 'PArray' requires that 'String' conform to 'P'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!

xedin added 2 commits February 8, 2019 15:04
If affected declaration is a static or instance memeber (excluding
operators) and failed requirement is declared in other nominal type
or extension, diagnose such problems as `in reference` instead of
claiming that requirement belongs to the member itself.
@xedin
Copy link
Contributor Author

xedin commented Feb 9, 2019

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Feb 9, 2019

Build failed
Swift Test Linux Platform
Git Sha - 42e0f21

@xedin
Copy link
Contributor Author

xedin commented Feb 9, 2019

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented Feb 9, 2019

Build failed
Swift Test OS X Platform
Git Sha - 42e0f21

@swift-ci
Copy link
Contributor

swift-ci commented Feb 9, 2019

Build failed
Swift Test Linux Platform
Git Sha - 42e0f21

@xedin
Copy link
Contributor Author

xedin commented Feb 9, 2019

@shahmishal Looks like this is something with the bot itself in the final phase.

@xedin
Copy link
Contributor Author

xedin commented Feb 11, 2019

@swift-ci please test

@xedin xedin merged commit 75b5824 into swiftlang:master Feb 11, 2019
// expected-note@-1 {{candidate requires that the types 'U' and 'V' be equivalent (requirement specified as 'U' == 'V')}}
// expected-note@-2 {{requirement from conditional conformance of 'SameTypeGeneric<U, V>' to 'P2'}}
// expected-note@-3 {{requirement from conditional conformance of 'SubclassBad' to 'P2'}}
// expected-note@-4 {{candidate requires that 'C1' inherit from 'U' (requirement specified as 'U' : 'C1')}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this read candidate requires that 'U' inherit from 'C1'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, probably, I didn't touch existing messages in declaration checker.

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.

4 participants