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

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

Issue 2769703002: Revert "Issue 28580. Relax instantiate to bounds." (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 adf6fc263f3116f2a3245ce13690cce3e70593e0..30188ffc31d455753ac985047284c67a8afc3de1 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -3330,125 +3330,58 @@ class C<T> {
expectStaticInvokeType('m();', '() → T');
}
- test_notInstantiatedBound_error_class_argument() async {
+ test_notInstantiatedBound_direct_class_class() async {
String code = r'''
-class A<K, V extends List<K>> {}
-class C<T extends A> {}
-''';
- await resolveTestUnit(code, noErrors: false);
- assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
- }
-
- test_notInstantiatedBound_error_class_argument2() async {
- String code = r'''
-class A<K, V extends List<List<K>>> {}
-class C<T extends A> {}
-''';
- await resolveTestUnit(code, noErrors: false);
- assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
- }
-
- test_notInstantiatedBound_error_class_direct() async {
- String code = r'''
-class A<K, V extends K> {}
+class A<T extends int> {}
class C<T extends A> {}
''';
await resolveTestUnit(code, noErrors: false);
assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
}
- test_notInstantiatedBound_error_class_indirect() async {
+ test_notInstantiatedBound_direct_class_typedef() async {
+ // Check that if the bound of a class is an uninstantiated typedef
+ // we emit an error
String code = r'''
-class A<K, V extends K> {}
-class C<T extends List<A>> {}
-''';
- await resolveTestUnit(code, noErrors: false);
- assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
- }
-
- test_notInstantiatedBound_error_typedef_argument() async {
- String code = r'''
-class A<K, V extends List<K>> {}
-typedef void F<T extends A>();
-''';
- await resolveTestUnit(code, noErrors: false);
- assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
- }
-
- test_notInstantiatedBound_error_typedef_argument2() async {
- String code = r'''
-class A<K, V extends List<List<K>>> {}
-typedef void F<T extends A>();
+typedef void F<T extends int>();
+class C<T extends F> {}
''';
await resolveTestUnit(code, noErrors: false);
assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
}
- test_notInstantiatedBound_error_typedef_direct() async {
+ test_notInstantiatedBound_direct_typedef_class() async {
+ // Check that if the bound of a typeded is an uninstantiated class
+ // we emit an error
String code = r'''
-class A<K, V extends K> {}
-typedef void F<T extends A>();
+class C<T extends int> {}
+typedef void F<T extends C>();
''';
await resolveTestUnit(code, noErrors: false);
assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
}
- test_notInstantiatedBound_ok_class() async {
- String code = r'''
-class A<T extends int> {}
-class C1<T extends A> {}
-class C2<T extends List<A>> {}
-''';
- await resolveTestUnit(code);
- assertNoErrors(testSource);
- }
-
- test_notInstantiatedBound_ok_class_class2() async {
- String code = r'''
-class A<T> {}
-class C<T extends A<int>> {}
-class D<T extends C> {}
-''';
- await resolveTestUnit(code);
- assertNoErrors(testSource);
- }
-
- test_notInstantiatedBound_ok_class_class3() async {
+ test_notInstantiatedBound_indirect_class_class() async {
String code = r'''
class A<T> {}
class B<T extends int> {}
class C<T extends A<B>> {}
''';
- await resolveTestUnit(code);
- assertNoErrors(testSource);
+ await resolveTestUnit(code, noErrors: false);
+ assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
}
- test_notInstantiatedBound_ok_class_class4() async {
+ test_notInstantiatedBound_indirect_class_class2() async {
String code = r'''
class A<K, V> {}
class B<T extends int> {}
class C<T extends A<B, B>> {}
''';
- await resolveTestUnit(code);
- assertNoErrors(testSource);
- }
-
- test_notInstantiatedBound_ok_class_typedef() async {
- String code = r'''
-typedef void F<T extends int>();
-class C<T extends F> {}
-''';
- await resolveTestUnit(code);
- assertNoErrors(testSource);
- }
-
- test_notInstantiatedBound_ok_typedef_class() async {
- String code = r'''
-class C<T extends int> {}
-typedef void F<T extends C>();
-''';
- await resolveTestUnit(code);
- assertNoErrors(testSource);
+ await resolveTestUnit(code, noErrors: false);
+ assertErrors(testSource, [
+ StrongModeCode.NOT_INSTANTIATED_BOUND,
+ StrongModeCode.NOT_INSTANTIATED_BOUND
+ ]);
}
test_objectMethodOnFunctions_Anonymous() async {
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698