Skip to content

Diagnostics: improve error message at attr diagnosis failure #35634

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 2 commits into from
Jan 30, 2021

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented Jan 28, 2021

Used to just crash:

Assertion failed: (loc.isValid() && "Diagnosing attribute with invalidlocation"), function diagnoseAndRemoveAttr

but now includes at least information what attribute caused the crash:

Attribute '@actorIndependent ' has invalid location, failed to diagnose!
Assertion failed: (false && "Diagnosing attribute with invalid location"), function diagnoseAndRemoveAttr


This way at least we know what attr caused the crash right away and I would have wasted less hours chasing the completely wrong thing 😉

    Used to just crash:

    > Assertion failed: (loc.isValid() && "Diagnosing attribute with invalid
    location"), function diagnoseAndRemoveAttr

    but now includes at least information what attribute caused the crash:

    > Attribute '@actorIndependent ' has invalid location, failed to
    diagnose!
    Assertion failed: (false && "Diagnosing attribute with invalid
    location"), function diagnoseAndRemoveAttr
@ktoso ktoso requested review from kavon and DougGregor January 28, 2021 12:05
@ktoso
Copy link
Contributor Author

ktoso commented Jan 28, 2021

This can show up when synthesized code interacts with attributes, e.g. when a protocol synthesized code implements has an attribute, and a note is issued about it

@ktoso
Copy link
Contributor Author

ktoso commented Jan 28, 2021

@swift-ci please smoke test

@DougGregor
Copy link
Member

Eh, this is alright by me

@ktoso ktoso requested a review from kavon January 29, 2021 07:57
@ktoso
Copy link
Contributor Author

ktoso commented Jan 29, 2021

Thanks @kavon, applied the ifndef.

@ktoso
Copy link
Contributor Author

ktoso commented Jan 29, 2021

@swift-ci please test

@ktoso ktoso merged commit 869b6fa into main Jan 30, 2021
@ktoso ktoso deleted the diagnostics-attr branch January 30, 2021 05:52
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.

3 participants