dotnet / dotnet/csharpstandard
12.6.3.12 Fixing - does not account for dynamic
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
The specification for _Fixing_ (as part of type inference) does not account for the `dynamic` type, which has an identity conversion to and from (but is no identical to) the type `object`.
Specifically, given
``` c#
class A {}
```
and a method
``` c#
T M(T x, T y);
```
and two values
``` c#
A x;
A y;
```
an invocation
``` c#
M(x, y)
```
should infer the type `A`. This is the behavior of existing C# compilers. But the specification of _12.6.3.12 Fixing_ says that type inference shall fail because there is not a *unique* type among the bounds to which all the other bounds convert. In this case the bounds are equivalent but not identical. Compilers implement a rule by which equivalent type arguments are merged, preferring `dynamic` over `object`. That should be specified.
Contributor guide
Assessment
This issue has not been assessed yet.