Skip to content

Improve diagnostic if where clause is missing a requirement #1281

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

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jan 26, 2023

Fixes #759
rdar://99730909

@ahoppen ahoppen requested a review from bnbarham January 26, 2023 16:18
@ahoppen
Copy link
Member Author

ahoppen commented Jan 26, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit cb60f52 into swiftlang:main Jan 27, 2023
@ahoppen ahoppen deleted the ahoppen/missing-requirement-diagnostic branch January 27, 2023 06:49
@ahoppen
Copy link
Member Author

ahoppen commented Jan 27, 2023

Oh, sorry, accidentally merged without waiting for a review, @bnbarham. I’ll address review feedback in a follow-up PR.

@@ -43,11 +43,11 @@ final class AttributeTests: XCTestCase {
""",
diagnostics: [
DiagnosticSpec(locationMarker: "1️⃣", message: "expected ':' and parameters in '@differentiable' argument", fixIts: ["insert ':' and parameters"]),
DiagnosticSpec(locationMarker: "2️⃣", message: "expected '=' and right-hand type in same type requirement", fixIts: ["insert '=' and right-hand type"]),
DiagnosticSpec(locationMarker: "2️⃣", message: "expected ':' or '==' to indicate a conformance or same-type requirement"),
Copy link
Contributor

Choose a reason for hiding this comment

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

We could suggest both as fix-its, but otherwise LGTM

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.

Generic where clause defaults to same-type requirement if no ==, :, etc is given
2 participants