eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
395 stars 62 forks source link

type arg inference should use self types to simplify inferred types #7407

Closed gavinking closed 5 years ago

gavinking commented 5 years ago

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.

gavinking commented 5 years ago

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

RossTate commented 5 years ago

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.

gavinking commented 5 years ago

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.

RossTate commented 5 years ago

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.