Target-Typed Conditional Expression proposal needs reconciling with latest draft C# spec
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 19h 10m
- Merged PRs (30d)
- 268
Description
I'm in the process of turning this proposal into actual text for the C# Standard, and have run into a problem re "Better Conversion from Expression."
The existing text to be changed **no longer exists in that form!** As of the draft-V7 spec in May 2022, that text ([§11.6.4.4](https://github.com/dotnet/csharpstandard/blob/draft-v7/standard/expressions.md#11644-better-conversion-from-expression)) is, as follows:
> Given an implicit conversion `C₁` that converts from an expression `E` to a type `T₁`, and an implicit conversion `C₂` that converts from an expression `E` to a type `T₂`, `C₁` is a ***better conversion*** than `C₂` if one of the following holds:
> - `E` exactly matches `T₁` and `E` does not exactly match `T₂` ([§11.6.4.5](expressions.md#11645-exactly-matching-expression))
> - `E` exactly matches both or neither of `T₁` and `T₂`, and `T₁` is a better conversion target than `T₂` ([§11.6.4.6](expressions.md#11646-better-conversion-target))
> - `E` is a method group ([§11.2](expressions.md#112-expression-classifications)), `T₁` is compatible ([§19.4](delegates.md#194-delegate-compatibility)) with the single best method from the method group for conversion `C₁`, and `T₂` is not compatible with the single best method from the method group for conversion `C₂`
As such, someone will need to redraft the proposed replacement text to reconcile it with the current spec.
---
#### Document Details
⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*
* ID: 634dc230-3ae2-6bc3-200e-922e42922aac
* Version Independent ID: 44b861bb-2fcb-7552-5e98-b98e7586ded8
* Content: [Target-typed conditional expression - C# 9.0 draft specifications](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/target-typed-conditional-expression)
* Content Source: [proposals/csharp-9.0/target-typed-conditional-expression.md](https://github.com/dotnet/csharplang/blob/main/proposals/csharp-9.0/target-typed-conditional-expression.md)
* Product: **dotnet-csharp**
* Technology: **csharp-spec**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **wiwagn**
Contributor guide
Assessment
This issue has not been assessed yet.