Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Feb 4, 2020

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
Member Author

jkotas commented Feb 4, 2020

Reverting the revert.

cc @AndyAyersMS @EgorBo

@jkotas
Copy link
Member Author

jkotas commented Feb 4, 2020

Failures are known issues.

@jkotas jkotas merged commit 2ddc9d2 into master Feb 4, 2020
@stephentoub stephentoub deleted the revert-31643-revert-1195-type-isassignedfrom branch February 5, 2020 16:54
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to 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