Skip to content

Sema: Fix crash when attempting to diagnose a contextual conversion o… #4879

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

slavapestov
Copy link
Contributor

  • Description: Fixes a crash on invalid code when we should produce a diagnostic.
  • Risk: Low, it's just a small change to a diagnostic path. The worst outcome here is a regression in QoI if we bail out too eagerly.
  • Tested: New test added, used to produce a bad diagnostic followed by a crash, now produces a diagnostic explaining the actual problem.
  • Reviewed by: @jrose-apple
  • JIRA: https://bugs.swift.org/browse/SR-2592, Radar: rdar://problem/28141573

…f an ambiguous expression

The fixits call back into the type checker via typeCheckCheckedCast(),
which sets up a new constraint system. As a result we would hit
assertions by introducing type variables from a previous "generation".

It seems that if we bail out of this code path altogether, we get a
better diagnostic -- in the provided test, it complains about an
ambiguous member to '.value', rather than not being able to convert
_? to V?.

Fixes <https://bugs.swift.org/browse/SR-2592>.
@slavapestov
Copy link
Contributor Author

@swift-ci Please test OS X

@slavapestov
Copy link
Contributor Author

Note: @jrose-apple already ACKd this over chat.

@tkremenek tkremenek merged commit 3e8db09 into swiftlang:swift-3.0-branch Sep 20, 2016
MaxDesiatov pushed a commit that referenced this pull request Sep 7, 2023
[pull] swiftwasm from main
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