dotnet / dotnet/csharpstandard
Half-Lifted Conversions
Open
type: bug
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
Given
```csharp
public struct S1
{
public static implicit operator C(S1 s)
{
return new C();
}
public static implicit operator S2?(S1 s)
{
return null;
}
}
public struct S2 { }
public class C { }
```
Existing compilers allow the following
```csharp
Func func1 = x => x;
Func func2 = x => x;
```
But neither is justified by the specification. It would be nice if the specification were revised to allow these.
Contributor guide
Assessment
This issue has not been assessed yet.