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

Handle generics in methodimpls for default interface methods #20404

Merged
merged 6 commits into from Nov 13, 2018

Conversation

@MichalStrehovsky
Copy link
Member

MichalStrehovsky commented Oct 12, 2018

The existing logic looking at MethodImpls to find the default interface implementation was not correct in the presence of generics. The MethodImpl records we build during type load only contain inexact MethodDescs for the declMethod that are not suitable for comparisons.

The fix is to pipe through the token and resolve the declaring method from it at the time of dispatch.

Fixes #16355.
Fixes #20281.
Fixes #16354.

The existing logic looking at MethodImpls to find the default interface implementation was not correct in the presence of generics. The MethodImpl record that we build during type load only contain inexact MethodDescs for the declMethod that are not suitable for comparisons.

The fix is to pipe through the token and resolve the declaring method from it at the time of dispatch.

Fixes #16355.
@MichalStrehovsky MichalStrehovsky requested a review from davidwrighton Oct 12, 2018
@MichalStrehovsky MichalStrehovsky added this to the 3.0 milestone Oct 12, 2018
@MichalStrehovsky MichalStrehovsky added this to TODO in Default Interface Methods via automation Oct 12, 2018
Ooops

// We do CanCastToInterface to also cover variance.
// We already know this is a method on the same type definition as the (generic)
// interface but we need to make sure the instantiations match.

This comment has been minimized.

Copy link
@davidwrighton

davidwrighton Oct 16, 2018

Member

Variant dispatch is typically done via a two pass technique. Wherein we first iterate to see if there is an exact match, and then a second iteration through the interfaces (of a particular type) to attempt to do a variant dispatch. Looking at the logic in this function, it appears that the variant matching rules here may not be followed, and the variance test cases added do not appear to cover the exact/inexact matching issue.

This comment has been minimized.

Copy link
@MichalStrehovsky

MichalStrehovsky Oct 16, 2018

Author Member

The issue of it ignoring variant interface dispatch rules and not doing two passes is orthogonal to the thing I'm fixing here.

I would prefer to track that in a separate issue/pull request for accounting purposes.

This comment has been minimized.

Copy link
@MichalStrehovsky

MichalStrehovsky Oct 16, 2018

Author Member

#20452

Copy link
Member

davidwrighton left a comment

🕐

@MichalStrehovsky

This comment has been minimized.

Copy link
Member Author

MichalStrehovsky commented Nov 12, 2018

@dotnet-bot test this please

@MichalStrehovsky

This comment has been minimized.

Copy link
Member Author

MichalStrehovsky commented Nov 13, 2018

@dotnet-bot test OSX10.12 x64 Checked Innerloop Build and Test

@MichalStrehovsky

This comment has been minimized.

Copy link
Member Author

MichalStrehovsky commented Nov 13, 2018

@dotnet-bot test OSX10.12 x64 Checked Innerloop Build and Test

Timed out...

@MichalStrehovsky MichalStrehovsky merged commit e95c1f8 into dotnet:master Nov 13, 2018
31 checks passed
31 checks passed
CentOS7.1 x64 Checked Innerloop Build and Test Build finished.
Details
CentOS7.1 x64 Debug Innerloop Build Build finished.
Details
Linux-musl x64 Debug Build Build finished.
Details
OSX10.12 x64 Checked Innerloop Build and Test Build finished.
Details
Tizen armel Cross Checked Innerloop Build and Test Build finished.
Details
Ubuntu arm Cross Checked Innerloop Build and Test Build finished.
Details
Ubuntu arm Cross Checked crossgen_comparison Build and Test Build finished.
Details
Ubuntu arm Cross Checked no_tiered_compilation_innerloop Build and Test Build finished.
Details
Ubuntu arm Cross Release crossgen_comparison Build and Test Build finished.
Details
Ubuntu x64 Checked CoreFX Tests Build finished.
Details
Ubuntu x64 Checked Innerloop Build and Test Build finished.
Details
Ubuntu x64 Checked Innerloop Build and Test (Jit - TieredCompilation=0) Build finished.
Details
Ubuntu x64 Formatting Build finished.
Details
Ubuntu16.04 arm64 Cross Checked Innerloop Build and Test Build finished.
Details
Ubuntu16.04 arm64 Cross Checked no_tiered_compilation_innerloop Build and Test Build finished.
Details
WIP ready for review
Details
Windows_NT arm Cross Debug Innerloop Build Build finished.
Details
Windows_NT arm64 Cross Debug Innerloop Build Build finished.
Details
Windows_NT x64 Checked CoreFX Tests Build finished.
Details
Windows_NT x64 Checked Innerloop Build and Test Build finished.
Details
Windows_NT x64 Checked Innerloop Build and Test (Jit - TieredCompilation=0) Build finished.
Details
Windows_NT x64 Formatting Build finished.
Details
Windows_NT x64 Release CoreFX Tests Build finished.
Details
Windows_NT x64 full_opt ryujit CoreCLR Perf Tests Correctness Build finished.
Details
Windows_NT x64 min_opt ryujit CoreCLR Perf Tests Correctness Build finished.
Details
Windows_NT x86 Checked Innerloop Build and Test Build finished.
Details
Windows_NT x86 Checked Innerloop Build and Test (Jit - TieredCompilation=0) Build finished.
Details
Windows_NT x86 Release Innerloop Build and Test Build finished.
Details
Windows_NT x86 full_opt ryujit CoreCLR Perf Tests Correctness Build finished.
Details
Windows_NT x86 min_opt ryujit CoreCLR Perf Tests Correctness Build finished.
Details
license/cla All CLA requirements met.
Details
Default Interface Methods automation moved this from TODO to Done Nov 13, 2018
@MichalStrehovsky MichalStrehovsky deleted the MichalStrehovsky:fix16355 branch Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.