Have S.L.Expressions accept conversions it incorrectly rejects. (dotnet/corefx#25768)
authorJon Hanna <jon@hackcraft.net>
Fri, 19 Jan 2018 06:28:24 +0000 (06:28 +0000)
committerVladimir Sadov <vsadov@microsoft.com>
Fri, 19 Jan 2018 06:28:24 +0000 (22:28 -0800)
commita969540eb5d3af2ae7af752a749bba12c08c364b
treeb2d0f9eaec5750d56f2c4e87c797c1f056092ea4
parentc97f91e47c3eb68a8b6b6c11c56a82a7057a6410
Have S.L.Expressions accept conversions it incorrectly rejects. (dotnet/corefx#25768)

* Have S.L.Expressions accept conversions it incorrectly rejects.

Extend the conversion checks to allow array-related explicit reference
that were rejected by Expression.Convert and Expression.CheckedConvert.

Fixes dotnet/corefx#25760, and hence fixes dotnet/corefx#25754

* Move test case that fails on netfx into separate non-netfx test

* CheckedConvert equivalent of tests

* Future-proof s_arrayAssignableInterfaces

Derive values for s_arrayAssignableInterfaces dynamically. Extra cost
is only spent once, but it will automatically deal with any future
additions to the generic interfaces supported by arrays.

Commit migrated from https://github.com/dotnet/corefx/commit/aa808b734f14a3803843bc6164678f7569f94f90
src/libraries/Microsoft.CSharp/tests/ExplicitConversionTests.cs [new file with mode: 0644]
src/libraries/Microsoft.CSharp/tests/Microsoft.CSharp.Tests.csproj
src/libraries/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs
src/libraries/System.Linq.Expressions/tests/Convert/ConvertCheckedTests.cs
src/libraries/System.Linq.Expressions/tests/Convert/ConvertTests.cs