Fix constrained call corner cases (#22464)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Mon, 18 Feb 2019 16:19:55 +0000 (17:19 +0100)
committerGitHub <noreply@github.com>
Mon, 18 Feb 2019 16:19:55 +0000 (17:19 +0100)
commit88249918cd01e8729c60c0f6c2cf8145d0bc3c55
tree961be409e2b2dee0f722d5e62f7082a53355a65d
parenta8d58d62d1009b41e423923ba66a041a99bea7cc
Fix constrained call corner cases (#22464)

Fixes #22423. I'm still unclear on how JitStress manages to get itself into that situation, but I was able to write a repro that triggers the `!pMDAfterConstraintResolution->IsInterface()` assert using regular IL, so we need to handle that either way. The repro for that is constrained3.il.

While figuring out the repro, I wrote a bunch of other test code and found another bug (constrained2), where we would box in a situations that doesn't require boxing (canonically ambiguous situation where there's a suitable default interface implementation and a valuetype implementation of the constrained method that does not requires boxing once we no longer deal with __Canon).
12 files changed:
src/vm/jitinterface.cpp
src/vm/methodtable.cpp
tests/issues.targets
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2.il [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2.ilproj [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm.il [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm.ilproj [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3.il [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3.ilproj [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3_gm.il [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained3_gm.ilproj [new file with mode: 0644]
tests/src/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrainedcall.il