8005179: Cleanup Resolve.AmbiguityError

Linearize nested ambiguity errors

Reviewed-by: jjg
This commit is contained in:
Maurizio Cimadamore 2013-01-08 10:16:26 +01:00
parent 159b251085
commit c932023b04
3 changed files with 93 additions and 65 deletions

View file

@ -25,7 +25,7 @@ class TargetType21 {
<R,A> void call(SAM3<R,A> sam) { }
void test() {
call(x -> { throw new Exception(); }); //ok - resolves to call(SAM1)
call(x -> { throw new Exception(); }); //ambiguous
call(x -> { System.out.println(""); }); //ok - resolves to call(SAM2)
call(x -> { return (Object) null; }); //error - call(SAM3) is not applicable because of cyclic inference
call(x -> { return null; }); ////ok - resolves to call(SAM1)

View file

@ -1,3 +1,3 @@
TargetType21.java:28:9: compiler.err.ref.ambiguous: call, kindname.method, call(TargetType21.SAM1), TargetType21, kindname.method, call(TargetType21.SAM2), TargetType21
TargetType21.java:30:9: compiler.err.cant.apply.symbols: kindname.method, call, @755,{(compiler.misc.inapplicable.method: kindname.method, TargetType21, call(TargetType21.SAM1), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, TargetType21, call(TargetType21.SAM2), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.unexpected.ret.val)))),(compiler.misc.inapplicable.method: kindname.method, TargetType21, <R,A>call(TargetType21.SAM3<R,A>), (compiler.misc.cyclic.inference: A))}
TargetType21.java:30:9: compiler.err.cant.apply.symbols: kindname.method, call, @737,{(compiler.misc.inapplicable.method: kindname.method, TargetType21, call(TargetType21.SAM1), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.String)))),(compiler.misc.inapplicable.method: kindname.method, TargetType21, call(TargetType21.SAM2), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.ret.type.in.lambda: (compiler.misc.unexpected.ret.val)))),(compiler.misc.inapplicable.method: kindname.method, TargetType21, <R,A>call(TargetType21.SAM3<R,A>), (compiler.misc.cyclic.inference: A))}
2 errors