test/tools/javac/lambda/MostSpecific03.java

Tue, 12 Mar 2013 16:02:43 +0000

author
mcimadamore
date
Tue, 12 Mar 2013 16:02:43 +0000
changeset 1628
5ddecb91d843
parent 0
959103a6100f
permissions
-rw-r--r--

8009545: Graph inference: dependencies between inference variables should be set during incorporation
Summary: Move all transitivity checks into the incorporation round
Reviewed-by: jjg

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  check correctness of structural most specific test routine
     6  * @compile/fail/ref=MostSpecific03.out -XDrawDiagnostics MostSpecific03.java
     7  */
     9 class Test {
    11     interface IntMapper {
    12         int map();
    13     }
    15     interface LongMapper {
    16         long map();
    17     }
    19     void m(IntMapper... im) { }
    20     void m(LongMapper... lm) { }
    22     void m2(IntMapper im1, IntMapper... im) { }
    23     void m2(LongMapper... lm) { }
    25     void test1() {
    26         m(); //ambiguous
    27         m(()->1); //ok
    28         m(()->1, ()->1); //ok
    29         m(()->1, ()->1, ()->1); //ok
    30     }
    32     void test2() {
    33         m(null, null); //ambiguous
    34         m(()->1, null); //ambiguous
    35         m(null, ()->1); //ambiguous
    36         m(()->1L, null); //ok
    37         m(null, ()->1L); //ok
    38     }
    40     void test3() {
    41         m2(); //ok
    42         m2(()->1); //ambiguous
    43         m2(()->1, ()->1); //ok
    44         m2(()->1, ()->1, ()->1); //ok
    45     }
    47     void test4() {
    48         m2(null, null, null); //ambiguous
    49         m2(()->1, null, null); //ambiguous
    50         m2(null, ()->1, null); //ambiguous
    51         m2(null, null, ()->1); //ambiguous
    52         m2(()->1, ()->1, null); //ambiguous
    53         m2(null, ()->1, ()->1); //ambiguous
    54         m2(()->1, null, ()->1); //ambiguous
    56         m2(()->1L, null, null); //ok
    57         m2(null, ()->1L, null); //ok
    58         m2(null, null, ()->1L); //ok
    59         m2(()->1L, ()->1L, null); //ok
    60         m2(null, ()->1L, ()->1L); //ok
    61         m2(()->1L, null, ()->1L); //ok
    62     }
    63 }

mercurial