Skip to content

Fix RCS1084#1085

Merged
josefpihrt merged 4 commits intodotnet:mainfrom
jamesHargreaves12:fix/RCS1084
Jun 1, 2023
Merged

Fix RCS1084#1085
josefpihrt merged 4 commits intodotnet:mainfrom
jamesHargreaves12:fix/RCS1084

Conversation

@jamesHargreaves12
Copy link
Copy Markdown
Contributor

If the types of a and b are polymorphic and we wish to null coalesce them (a??b), then we must cast the LHS of the null coalesce operator to the base type, or the compiler will throw an error (i.e. (Base?)a??b https://stackoverflow.com/questions/25240564/polymorphic-null-coalescing-operator

A complete example is given in the test code below.

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