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

Add support for common type of int and double?. #1806

Merged
merged 1 commit into from
Sep 6, 2018

Conversation

gafter
Copy link
Member

@gafter gafter commented Aug 21, 2018

See #881

As requested by LDM about a year ago

@gafter
Copy link
Member Author

gafter commented Aug 21, 2018

@MadsTorgersen @dotnet/ldm Could someone please look at this and verify that it is as expected?

@alrz
Copy link
Contributor

alrz commented Aug 12, 2019

There's a prototype available over at alrz/roslyn@645c343.

@alrz
Copy link
Contributor

alrz commented Aug 15, 2019

@gafter Can you please take a look at the above commit to see if it's using the right approach. Thanks.

@gafter
Copy link
Member Author

gafter commented Aug 16, 2019

I will look at it when back from vacation on Monday.

@alrz
Copy link
Contributor

alrz commented Sep 9, 2019

HashSet can handle a null value, in the next iteration I'm going to use null to signify a null literal in the BestType algorithm. btw should this change include target-typing for ?: and ?? expressions? If so I'd be happy to take a stab at it.

@gafter
Copy link
Member Author

gafter commented Sep 11, 2019

@alrz I don't think the approach you are taking addresses the problem described in the title of this issue. See also #881

If we target-type ?? and ?: as we plan to, there will be less motivation for making this change.

@alrz
Copy link
Contributor

alrz commented Sep 11, 2019

It's buried in the diff https://github.com/alrz/roslyn/blob/645c343114b9eec2c069242d231cfce95af1e40c/src/Compilers/CSharp/Test/Semantic/Semantics/NullableEnhancedCommonTypeTests.cs

I think the compiler yields the correct result for both int?/double => double? and double/null => double? however, as I saw in that prototype (at least the way I wrote it), doing either of cases just does not fit into the current way of how things are done, we need to make a lot of exceptions and whatnot.

If we target-type ?? and ?: as we plan to, there will be less motivation for making this change.

makes sense. target-typing of those would have the same effect. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants