duchess-rs / duchess

Silky smooth Java-Rust interop

Home Page:https://duchess-rs.github.io/duchess/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test for edge cases in method dispatch

nikomatsakis opened this issue · comments

PR #73 implemented a new method dispatch algorithm that I believe handles all kinds of edge cases correctly, but we don't have tests for most of them.

Scenarios I think we should test (there are probably more I'm not thinking about)

  • interface Foo extends Bar, Baz -- check that we can call methods on any of those 3 interfaces, even if Bar does not extend Baz; check that we can do it on both an &Foo object and on a impl JavaMethod<Foo> operation
  • Diamond inheritance scenarios or other DAGs
  • Method with a covariant return type defined in a class C that refines the method from a superclass D, invoked on &C
  • Method with a covariant return type defined in a class C that refines the method from an interface I, invoked on &C
  • Method with a covariant return type defined in an interface I that extends another interface J, invoked on an &I
  • Method with a covariant return type defined in an interface I that extends another interface J but invoked on a class C that implements I

I think that about would be pretty good. Note that the last few tests ought to fail until #79 is fixed -- or at least we should be able to make some that do.