eclipse-archived/ceylon

type arg inference should use self types to simplify inferred types

Closed this issue · 4 comments

Instead of inferring types like Summable<Integer>&Comparable<Integer>&Integer, the type arg inference algorithm should use the self type information to simplify this to just Integer.

I implemented this, but then figured out it's a bad idea, since sometimes it makes arguments un-assignable to parameter types. Closing.

For type-argument inference you should ignore "shape" interfaces/classes, i.e. inferfaces/classes with an of clause. If there are any constraints of that form, just check them after you've decided with the inferred type argument is.

For type-argument inference you should ignore "shape" interfaces/classes

Ah, right, sure. That's pretty much what this issue was getting at, but since we still have not implemented the shape/type split, our "shapes" can still be used as types, and so this change broke at least some (contrived) code.

Now might be a good time for me to take a much closer look at your work on shapes, @RossTate.

Sure. Sounds like we should talk about of coverage along with wildcard capture (and maybe higher-kinded type parameters) while we're at it. Let me know when would be a good time to chat MWF.