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

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

Issue 2456803004: fixes #27586, prefer context type in generic inference (Closed)
Patch Set: wip Created 3 years, 11 months 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 73561292fb44a59a8034b19f13b18e3329304b0e..ae60924c2afed7a8c46ffa7ca754f581a796dd93 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -1450,11 +1450,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> {

Powered by Google App Engine
This is Rietveld 408576698