Move test_methodCallTypeInference_mixinType into mixin_test.dart
Addresses code review comments on https://dart-review.googlesource.com/c/sdk/+/81322.
Change-Id: I8c8bd20f024a849042ff862f755a4187765f6201
Reviewed-on: https://dart-review.googlesource.com/c/81330
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/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index be2fa81..a40a5eb 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -3655,29 +3655,6 @@
verify([source]);
}
- test_methodCallTypeInference_mixinType() async {
- Source source = addSource('''
-main() {
- C<int> c = f();
-}
-
-class C<T> {}
-
-mixin M<T> on C<T> {}
-
-M<T> f<T>() => null;
-''');
- var result = await computeAnalysisResult(source);
- assertNoErrors(source);
- verify([source]);
- var main = result.unit.declarations[0] as FunctionDeclaration;
- var body = main.functionExpression.body as BlockFunctionBody;
- var cDeclaration = body.block.statements[0] as VariableDeclarationStatement;
- var fInvocation =
- cDeclaration.variables.variables[0].initializer as MethodInvocation;
- expect(fInvocation.staticInvokeType.toString(), '() → M<int>');
- }
-
test_methodDeclaration_scope_signature() async {
Source source = addSource(r'''
const app = 0;
diff --git a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
index ca8630a..e086247 100644
--- a/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/mixin_test.dart
@@ -2,6 +2,7 @@
// 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/dart/ast/ast.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -1693,6 +1694,24 @@
expect(annotation.elementAnnotation, same(metadata[0]));
}
+ test_methodCallTypeInference_mixinType() async {
+ addTestFile('''
+main() {
+ C<int> c = f();
+}
+
+class C<T> {}
+
+mixin M<T> on C<T> {}
+
+M<T> f<T>() => null;
+''');
+ await resolveTestFile();
+ assertNoTestErrors();
+ var fInvocation = findNode.methodInvocation('f()');
+ expect(fInvocation.staticInvokeType.toString(), '() → M<int>');
+ }
+
test_onClause() async {
addTestFile(r'''
class A {}