| Index: pkg/front_end/testcases/inference/downwards_inference_on_generic_constructor_arguments_infer_downwards.dart
|
| diff --git a/pkg/front_end/testcases/inference/downwards_inference_on_generic_constructor_arguments_infer_downwards.dart b/pkg/front_end/testcases/inference/downwards_inference_on_generic_constructor_arguments_infer_downwards.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5926fd5d37b6cba3cd783535018e73772d771e9d
|
| --- /dev/null
|
| +++ b/pkg/front_end/testcases/inference/downwards_inference_on_generic_constructor_arguments_infer_downwards.dart
|
| @@ -0,0 +1,104 @@
|
| +// Copyright (c) 2017, 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.
|
| +
|
| +/*@testedFeatures=inference*/
|
| +library test;
|
| +
|
| +class F0<T> {
|
| + F0(List<T> a) {}
|
| +}
|
| +
|
| +class F1<T> {
|
| + F1({List<T> a}) {}
|
| +}
|
| +
|
| +class F2<T> {
|
| + F2(Iterable<T> a) {}
|
| +}
|
| +
|
| +class F3<T> {
|
| + F3(Iterable<Iterable<T>> a) {}
|
| +}
|
| +
|
| +class F4<T> {
|
| + F4({Iterable<Iterable<T>> a}) {}
|
| +}
|
| +
|
| +void main() {
|
| + new F0<int>(/*@typeArgs=int*/ []);
|
| + new F0<int>(/*@typeArgs=int*/ [3]);
|
| + new F0<int>(
|
| + /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"]);
|
| + new F0<int>(/*@typeArgs=int*/ [
|
| + /*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello",
|
| + 3
|
| + ]);
|
| +
|
| + new F1<int>(a: /*@typeArgs=int*/ []);
|
| + new F1<int>(a: /*@typeArgs=int*/ [3]);
|
| + new F1<int>(a: /*@typeArgs=int*/ [
|
| + /*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"
|
| + ]);
|
| + new F1<int>(a: /*@typeArgs=int*/ [
|
| + /*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello",
|
| + 3
|
| + ]);
|
| +
|
| + new F2<int>(/*@typeArgs=int*/ []);
|
| + new F2<int>(/*@typeArgs=int*/ [3]);
|
| + new F2<int>(
|
| + /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"]);
|
| + new F2<int>(/*@typeArgs=int*/ [
|
| + /*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello",
|
| + 3
|
| + ]);
|
| +
|
| + new F3<int>(/*@typeArgs=Iterable<int>*/ []);
|
| + new F3<int>(/*@typeArgs=Iterable<int>*/ [
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| + new F3<int>(/*@typeArgs=Iterable<int>*/ [
|
| + /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"]
|
| + ]);
|
| + new F3<int>(/*@typeArgs=Iterable<int>*/ [
|
| + /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"],
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| +
|
| + new F4<int>(a: /*@typeArgs=Iterable<int>*/ []);
|
| + new F4<int>(a: /*@typeArgs=Iterable<int>*/ [
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| + new F4<int>(a: /*@typeArgs=Iterable<int>*/ [
|
| + /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"]
|
| + ]);
|
| + new F4<int>(a: /*@typeArgs=Iterable<int>*/ [
|
| + /*@typeArgs=int*/ [/*error:LIST_ELEMENT_TYPE_NOT_ASSIGNABLE*/ "hello"],
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| +
|
| + /*@typeArgs=dynamic*/ new F3(/*@typeArgs=Iterable<dynamic>*/ []);
|
| + var /*@type=F3<int>*/ f31 = /*@typeArgs=int*/ new F3(/*@typeArgs=List<int>*/ [
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| + var /*@type=F3<String>*/ f32 = /*@typeArgs=String*/ new F3(/*@typeArgs=List<String>*/ [
|
| + /*@typeArgs=String*/ ["hello"]
|
| + ]);
|
| + var /*@type=F3<Object>*/ f33 = /*@typeArgs=Object*/ new F3(/*@typeArgs=List<Object>*/ [
|
| + /*@typeArgs=String*/ ["hello"],
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| +
|
| + /*@typeArgs=dynamic*/ new F4(a: /*@typeArgs=Iterable<dynamic>*/ []);
|
| + /*@typeArgs=int*/ new F4(a: /*@typeArgs=List<int>*/ [
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| + /*@typeArgs=String*/ new F4(a: /*@typeArgs=List<String>*/ [
|
| + /*@typeArgs=String*/ ["hello"]
|
| + ]);
|
| + /*@typeArgs=Object*/ new F4(a: /*@typeArgs=List<Object>*/ [
|
| + /*@typeArgs=String*/ ["hello"],
|
| + /*@typeArgs=int*/ [3]
|
| + ]);
|
| +}
|
|
|