Index: pkg/analyzer/test/generated/strong_mode_test.dart |
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart |
index e86f73a04fe196a71fc9f8fd644ee30c832f4184..679851f857aa3d1998b405b5d63f0ff3c72495bd 100644 |
--- a/pkg/analyzer/test/generated/strong_mode_test.dart |
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart |
@@ -188,7 +188,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase { |
_isInstantiationOf(_hasElement(elementB))([_isDynamic])(type); |
} |
- fail_pinning_multipleConstraints2() async { |
+ test_pinning_multipleConstraints2() async { |
// Test that downwards inference with two identical downwards covariant |
// constraints on the same parameter correctly infers and pins the type |
String code = r''' |
@@ -242,7 +242,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase { |
_isInstantiationOf(_hasElement(elementB))([_isDynamic])(type); |
} |
- fail_returnType_variance2() async { |
+ pass_returnType_variance2() async { |
Leaf
2017/02/17 22:26:03
Should this be test_? Or is this a valid prefix?
Jennifer Messerly
2017/03/14 02:07:07
good catch. fixed & test passes :)
|
// Check that downwards inference correctly pins a type parameter |
// when the parameter is constrained in a covariant position |
String code = r''' |
@@ -262,7 +262,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase { |
invoke.staticInvokeType); |
} |
- fail_returnType_variance6() async { |
+ pass_returnType_variance6() async { |
// Check that pinning works correctly with a partial type |
// when the return type uses the variable in a covariant position |
String code = r''' |
@@ -1015,7 +1015,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase { |
T mk<T>(T x) => null; |
FutureOr<int> test() => mk(new Future.value(42)); |
'''); |
- _isFutureOfInt(invoke.staticType); |
+ _isFutureOrOfInt(invoke.staticType); |
_isFutureOfInt(invoke.argumentList.arguments[0].staticType); |
} |
@@ -1087,7 +1087,7 @@ class StrongModeLocalInferenceTest extends ResolverTestCase { |
dynamic test() => mk(new Future<int>.value(42)); |
''', |
errors: [StrongModeCode.COULD_NOT_INFER]); |
- _isFutureOf([_isObject])(invoke.staticType); |
+ _isFutureOfInt(invoke.staticType); |
} |
test_futureOr_assignFromValue() async { |
@@ -2231,11 +2231,28 @@ class D<S> { |
} |
test_genericFunction_upwardsAndDownwards() async { |
- // Regression tests for https://github.com/dart-lang/sdk/issues/27151. |
+ // Regression tests for https://github.com/dart-lang/sdk/issues/27586. |
await resolveTestUnit(r'List<num> x = [1, 2];'); |
- expectInitializerType('x', 'List<int>'); |
+ expectInitializerType('x', 'List<num>'); |
+ } |
+ |
+ test_genericFunction_upwardsAndDownwards_Object() async { |
+ // Regression tests for https://github.com/dart-lang/sdk/issues/27625. |
+ await resolveTestUnit(r''' |
+List<Object> aaa = []; |
+List<Object> bbb = [1, 2, 3]; |
+List<Object> ccc = [null]; |
+List<Object> ddd = [1 as dynamic]; |
+List<Object> eee = [new Object()]; |
+ '''); |
+ expectInitializerType('aaa', 'List<Object>'); |
+ expectInitializerType('bbb', 'List<Object>'); |
+ expectInitializerType('ccc', 'List<Object>'); |
+ expectInitializerType('ddd', 'List<Object>'); |
+ expectInitializerType('eee', 'List<Object>'); |
} |
+ |
test_genericMethod() async { |
await resolveTestUnit(r''' |
class C<E> { |
@@ -2885,6 +2902,21 @@ class C<T> { |
expectStaticInvokeType('m(null', '(T, List<T>) → void'); |
} |
+ test_instantiateToBounds_method_ok_referenceOther_before2() async { |
+ String code = r''' |
+class C<T> { |
+ Map<S0, S1> m<S0 extends T, S1 extends List<S0>>() => null; |
+ |
+ void main() { |
+ m(); |
+ } |
+} |
+'''; |
+ await resolveTestUnit(code); |
+ assertNoErrors(testSource); |
+ expectStaticInvokeType('m();', '() → Map<T, List<T>>'); |
+ } |
+ |
test_instantiateToBounds_method_ok_simpleBounds() async { |
String code = r''' |
class C<T> { |
@@ -2900,6 +2932,21 @@ class C<T> { |
expectStaticInvokeType('m(null)', '(T) → void'); |
} |
+ test_instantiateToBounds_method_ok_simpleBounds2() async { |
+ String code = r''' |
+class C<T> { |
+ S m<S extends T>() => null; |
+ |
+ void main() { |
+ m(); |
+ } |
+} |
+'''; |
+ await resolveTestUnit(code); |
+ assertNoErrors(testSource); |
+ expectStaticInvokeType('m();', '() → T'); |
+ } |
+ |
test_notInstantiatedBound_direct_class_class() async { |
String code = r''' |
class A<T extends int> {} |