Rework the class hierarchy of StrongModeStaticTypeAnalyzer2Test.
The tests are moved into a mixin,
StrongModeStaticTypeAnalyzer2TestCases, which both
StrongModeStaticTypeAnalyzer2Test and
StrongModeStaticTypeAnalyzer2Test_Driver apply separately. This
allows tests to be marked as failing in
StrongModeStaticTypeAnalyzer2Test without affecting
StrongModeStaticTypeAnalyzer2Test_Driver.
Change-Id: Iabd641d5ecf03fd0481baf053e689d68a0e0e7a1
Reviewed-on: https://dart-review.googlesource.com/c/78705
Commit-Queue: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Auto-Submit: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/test/generated/strong_mode_driver_test.dart b/pkg/analyzer/test/generated/strong_mode_driver_test.dart
index 4e83452..ec98e5b 100644
--- a/pkg/analyzer/test/generated/strong_mode_driver_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_driver_test.dart
@@ -2,8 +2,10 @@
// 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.
+import 'package:analyzer/src/generated/engine.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
+import 'resolver_test_case.dart';
import 'strong_mode_test.dart';
main() {
@@ -22,10 +24,17 @@
@reflectiveTest
class StrongModeStaticTypeAnalyzer2Test_Driver
- extends StrongModeStaticTypeAnalyzer2Test {
+ extends StaticTypeAnalyzer2TestShared
+ with StrongModeStaticTypeAnalyzer2TestCases {
@override
bool get enableNewAnalysisDriver => true;
+ void setUp() {
+ super.setUp();
+ AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+ resetWith(options: options);
+ }
+
@failingTest
@override
test_genericFunction_parameter() {
@@ -67,15 +76,35 @@
}
@override
- test_notInstantiatedBound_class_error_recursion() {
- // overridden because not failing
- return super.test_notInstantiatedBound_class_error_recursion();
+ @failingTest
+ test_genericMethod_nestedCaptureBounds() {
+ // https://github.com/dart-lang/sdk/issues/30236
+ return super.test_genericMethod_nestedCaptureBounds();
}
@override
- test_notInstantiatedBound_class_error_recursion_less_direct() {
- // overridden because not failing
- return super.test_notInstantiatedBound_class_error_recursion_less_direct();
+ @failingTest
+ test_genericMethod_tearoff_instantiated() {
+ return super.test_genericMethod_tearoff_instantiated();
+ }
+
+ @override
+ @failingTest
+ test_instantiateToBounds_class_error_extension_malbounded() {
+ return super.test_instantiateToBounds_class_error_extension_malbounded();
+ }
+
+ @override
+ @failingTest
+ test_instantiateToBounds_class_error_instantiation_malbounded() {
+ return super
+ .test_instantiateToBounds_class_error_instantiation_malbounded();
+ }
+
+ @override
+ @failingTest
+ test_instantiateToBounds_generic_function_error_malbounded() {
+ return super.test_instantiateToBounds_generic_function_error_malbounded();
}
}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index d302e2f..2c0ada5 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -2796,18 +2796,67 @@
* Strong mode static analyzer end to end tests
*/
@reflectiveTest
-class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared {
- void expectStaticInvokeType(String search, String type) {
- var invocation = findIdentifier(search).parent as MethodInvocation;
- expect(invocation.staticInvokeType.toString(), type);
- }
-
+class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared
+ with StrongModeStaticTypeAnalyzer2TestCases {
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
resetWith(options: options);
}
+ @override
+ @failingTest
+ test_genericMethod_nestedCaptureBounds() {
+ // https://github.com/dart-lang/sdk/issues/30236
+ return super.test_genericMethod_nestedCaptureBounds();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_tearoff_instantiated() {
+ return super.test_genericMethod_tearoff_instantiated();
+ }
+
+ @override
+ @failingTest
+ test_instantiateToBounds_class_error_extension_malbounded() {
+ return super.test_instantiateToBounds_class_error_extension_malbounded();
+ }
+
+ @override
+ @failingTest
+ test_instantiateToBounds_class_error_instantiation_malbounded() {
+ return super
+ .test_instantiateToBounds_class_error_instantiation_malbounded();
+ }
+
+ @override
+ @failingTest
+ test_instantiateToBounds_generic_function_error_malbounded() {
+ return super.test_instantiateToBounds_generic_function_error_malbounded();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_class_error_recursion() {
+ return super.test_notInstantiatedBound_class_error_recursion();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_class_error_recursion_less_direct() {
+ return super.test_notInstantiatedBound_class_error_recursion_less_direct();
+ }
+}
+
+/// Test cases for [StrongModeStaticTypeAnalyzer2Test]
+abstract class StrongModeStaticTypeAnalyzer2TestCases
+ implements StaticTypeAnalyzer2TestShared {
+ void expectStaticInvokeType(String search, String type) {
+ var invocation = findIdentifier(search).parent as MethodInvocation;
+ expect(invocation.staticInvokeType.toString(), type);
+ }
+
test_dynamicObjectGetter_hashCode() async {
String code = r'''
main() {
@@ -3348,7 +3397,6 @@
expectIdentifierType('f;', '<S₀>(S₀) → S');
}
- @failingTest // https://github.com/dart-lang/sdk/issues/30236
test_genericMethod_nestedCaptureBounds() async {
await resolveTestUnit(r'''
class C<T> {
@@ -3574,7 +3622,6 @@
expectIdentifierType('paramTearOff', "<T>(T) → T");
}
- @failingTest
test_genericMethod_tearoff_instantiated() async {
await resolveTestUnit(r'''
class C<E> {
@@ -3715,7 +3762,6 @@
expect(p.enclosingElement, same(fType.element));
}
- @failingTest
test_instantiateToBounds_class_error_extension_malbounded() async {
// Test that superclasses are strictly checked for malbounded default
// types
@@ -3727,7 +3773,6 @@
assertErrors(testSource, [StrongModeCode.NO_DEFAULT_BOUNDS]);
}
- @failingTest
test_instantiateToBounds_class_error_instantiation_malbounded() async {
// Test that instance creations are strictly checked for malbounded default
// types
@@ -3856,7 +3901,6 @@
expectIdentifierType('d;', 'D<A<dynamic>>');
}
- @failingTest
test_instantiateToBounds_generic_function_error_malbounded() async {
// Test that generic methods are strictly checked for malbounded default
// types
@@ -3941,7 +3985,6 @@
''');
}
- @failingTest
test_notInstantiatedBound_class_error_recursion() async {
String code = r'''
class A<T extends B> {} // points to a
@@ -3956,7 +3999,6 @@
]);
}
- @failingTest
test_notInstantiatedBound_class_error_recursion_less_direct() async {
String code = r'''
class A<T extends B<A>> {}