Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1042)

Unified Diff: pkg/analyzer/test/generated/strong_mode_test.dart

Issue 2456803004: fixes #27586, prefer context type in generic inference (Closed)
Patch Set: more tweaks Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 783b462616b95a008052c4bdf2b34804f196ce59..550e4a651492d39bab309e007cba9995a501c151 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -1452,11 +1452,28 @@ class D<S> {
}
void test_genericFunction_upwardsAndDownwards() {
- // Regression tests for https://github.com/dart-lang/sdk/issues/27151.
+ // Regression tests for https://github.com/dart-lang/sdk/issues/27586.
resolveTestUnit(r'List<num> x = [1, 2];');
- expectInitializerType('x', 'List<int>');
+ expectInitializerType('x', 'List<num>');
}
+ void test_genericFunction_upwardsAndDownwards_Object() {
Leaf 2016/11/30 05:24:30 Can you add a version of this using generic method
+ // Regression tests for https://github.com/dart-lang/sdk/issues/27625.
+ 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()];
Leaf 2016/11/30 05:24:29 Do we have any test cases for inference which uses
+ ''');
+ expectInitializerType('aaa', 'List<Object>');
+ expectInitializerType('bbb', 'List<Object>');
+ expectInitializerType('ccc', 'List<Object>');
+ expectInitializerType('ddd', 'List<Object>');
+ expectInitializerType('eee', 'List<Object>');
+ }
+
+
void test_genericMethod() {
resolveTestUnit(r'''
class C<E> {

Powered by Google App Engine
This is Rietveld 408576698