blob: 5d2e5425675fa5b84c188eb7bb4b550846e6fde1 [file] [log] [blame]
 // TODO(multitest): This was automatically migrated from a multitest and may // contain strange or dead code. // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. // Test least upper bound through type checking of conditionals. class N { T get n => null; } class C1 extends N>> { T get c1 => null; } class C2 extends N>>>> { T get c2 => null; } /** * Test that we don't try to find the least upper bound by applying the * algorithm for finding the most specific common declaration recursively on * type arguments. * * For C1 and N> this would result in this infinite chain of * computations: * * lub(C1, N>) = lub(N>>, N>) * => * lub(N>, C1) = lub(N>, N>>) * => * lub(C1, N>) = lub(N>>, N>>) * => ... */ void testC1(bool z, C1 a, N> b) { if (z) { // The least upper bound of C1 and N> is Object since the // supertypes are // {C1, N>>, Object} for C1 and // {N>, Object} for N> and // Object is the most specific type in the intersection of the supertypes. // Is least upper bound dynamic? // Is least upper bound N<...> ? // Is least upper bound C1<...> ? // Is least upper bound N ? // Is least upper bound N> ? // Is least upper bound N> ? } } /** * Test that we don't try to find the least upper bound by applying the * algorithm for finding the most specific common declaration recursively on * type arguments. * * For C1 and N> this would result in this infinite and * expanding chain of computations: * * lub(C2, N>) = lub(N>>>>, N>) * => * lub(N>>>, C2) = * lub(N>>>, N>>>>) * => * lub(C2>>, N>>>) = * lub(N>>>>, N>>>>) * => ... */ void testC2(bool z, C2 a, N> b) { if (z) { // The least upper bound of C2 and N> is Object since the // supertypes are // {C2, N>>>>, Object} for C1 and // {N>, Object} for N> and // Object is the most specific type in the intersection of the supertypes. // Is least upper bound dynamic? // Is least upper bound N<...> ? // Is least upper bound C2<...> ? // Is least upper bound N ? // Is least upper bound N> ? // Is least upper bound N> ? } } void main() { testC1(false, null, null); testC2(false, null, null); }