Skip to content

Optimize typeof(T1).IsAssignableFrom(typeof(T2)) - #31705

Merged
jkotas merged 1 commit into
masterfrom
revert-31643-revert-1195-type-isassignedfrom
Feb 4, 2020
Merged

Optimize typeof(T1).IsAssignableFrom(typeof(T2))#31705
jkotas merged 1 commit into
masterfrom
revert-31643-revert-1195-type-isassignedfrom

Conversation

@jkotas

Copy link
Copy Markdown
Member

Optimize typeof(T1).IsAssignableFrom(typeof(T2)) to true/false. E.g.

typeof(IEnumerable<object>).IsAssignableFrom(typeof(string[]));// to `true`

compareTypesForCast seems does everything I need for IsAssignableFrom: handles COMObjects, __Canon, covariance/contravariance, etc. The only thing - it gives up on Nullable<>.

Contributes to https://github.com/dotnet/coreclr/issues/2591

@jkotas

Copy link
Copy Markdown
MemberAuthor

Reverting the revert.

cc @AndyAyersMS@EgorBo

@jkotas

Copy link
Copy Markdown
MemberAuthor

Failures are known issues.

@jkotas
jkotas merged commit 2ddc9d2 into masterFeb 4, 2020
@stephentoub
stephentoub deleted the revert-31643-revert-1195-type-isassignedfrom branch February 5, 2020 16:54
@ghostghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jkotas