class Top {
}
class Middle extends Top {
}
class Bottom extends Middle {
}
class Up {
void cv(Top t);
void ctv(Bottom b);
}
class Down extends Up {
/* There is an ambiguity about which version of the overloaded
method "cv" this
* alternative belongs to.
* Try to use more patterns.
*
* Possible methods:
* nice.lang.void cv(cocon.Down this, Middle m) defined
.\cocon\cocon.nice: line 16, column 8
* nice.lang.void cv(cocon.Up this, Top t) defined .\cocon\cocon.nice:
line 11, column 8
*/
//void cv(Middle m);
void ctv(Middle m);
}
cv(u@Up, t@Top) {
System.out.println("Up");
}
ctv(u@Up, b@Bottom) {
System.out.println("Up");
}
cv(d@Down, t@Middle) {
System.out.println("Down");
}
ctv(u@Down, b@Middle) {
System.out.println("Down");
}
main(args){
Up u = new Up(), ud = new Down();
Down d = new Down();
Top t = new Top();
Middle m = new Middle();
Bottom b = new Bottom();
System.out.println("-- first test suite");
u.cv(t);
u.cv(m);
u.cv(b);
/* No possible call for ctv.
* Arguments: (cocon.Up, cocon.Top)
* Possibilities:
* nice.lang.void ctv(cocon.Down this, Middle m)
* nice.lang.void ctv(cocon.Up this, Bottom b)
*/
//u.ctv(t);
/* No possible call for ctv.
* Arguments: (cocon.Up, cocon.Middle)
* Possibilities:
* nice.lang.void ctv(cocon.Down this, Middle m)
* nice.lang.void ctv(cocon.Up this, Bottom b)
*/
//u.ctv(m);
u.ctv(b);
System.out.println("-- second test suite");
d.cv(t);
d.cv(m);
d.cv(b);
/* No possible call for ctv.
* Arguments: (cocon.Down, cocon.Top)
* Possibilities:
* nice.lang.void ctv(cocon.Down this, Middle m)
* nice.lang.void ctv(cocon.Up this, Bottom b)
*/
//d.ctv(t);
d.ctv(m);
/* Ambiguity for symbol ctv. Possibilities are :
* nice.lang.void ctv(cocon.Down this, Middle m)
* nice.lang.void ctv(cocon.Up this, Bottom b)
*/
//d.ctv(b);
System.out.println("-- third test suite");
ud.cv(t);
ud.cv(m);
ud.cv(b);
/* No possible call for ctv.
* Arguments: (cocon.Up, cocon.Top)
* Possibilities:
* nice.lang.void ctv(cocon.Down this, Middle m)
* nice.lang.void ctv(cocon.Up this, Bottom b)
*/
//ud.ctv(t);
/* No possible call for ctv.
* Arguments: (cocon.Up, cocon.Middle)
* Possibilities:
* nice.lang.void ctv(cocon.Down this, Middle m)
* nice.lang.void ctv(cocon.Up this, Bottom b)
*/
//ud.ctv(m);
ud.ctv(b);
}
// run
-- first test suite
Up
Up
Up
//
//
Up
-- second test suite
Up
Down
Down
//
Down
//
-- third test suite
Up
Down
Down
//
//
Up