haxetink / tink_macro

The macro toolkit
MIT License
57 stars 17 forks source link

Deduce common base type from a list of types #33

Closed kevinresol closed 3 years ago

kevinresol commented 3 years ago

This relies on the compiler to deduce the common types. I am not very sure if the behaviour is clearly specified. For example:

interface I1 {}
interface I2 {}
class A implements I2 implements I1 {}
class B implements I2 implements I1 {}
class C implements I1 implements I2 {}
class D implements I1 implements I2 {}

deduceCommonType(A, B); // I2
deduceCommonType(C, D); // I1
back2dos commented 3 years ago

Well, I suppose the ambiguity is quite an extreme edge case. There are probably going to be problems in diagnostics, but let's solve those at a later time ;)