Skip to content
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

Fix implicit conversion in expressions like C ? P : null #1716

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

exyi
Copy link
Member

@exyi exyi commented Oct 18, 2023

Fixes compilation of ternary expressions with ambiguous conversion (in C?A:B A is convertible to B while B is also convertible to A). This is normally disallowed in C#, but I specifically allowed two cases

  • one of them is object which can be converted to the other type - this occurs if the object is null
  • one of them is string which is convertible to the other type - this occurs for our enum constant literals

should fix part of #1694

@exyi exyi force-pushed the condition-null-implicit-conversion branch from 3d44caf to 72dffb2 Compare October 18, 2023 19:03
@tomasherceg tomasherceg merged commit 5bd1ee7 into main Oct 22, 2023
14 checks passed
@tomasherceg tomasherceg deleted the condition-null-implicit-conversion branch October 22, 2023 08:11
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