Skip to content

Commit

Permalink
Move test_methodCallTypeInference_mixinType into mixin_test.dart
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stereotype441 authored and commit-bot@chromium.org committed Oct 24, 2018
1 parent 3e750a7 commit 9aff930
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
23 changes: 0 additions & 23 deletions pkg/analyzer/test/generated/non_error_resolver_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3655,29 +3655,6 @@ enum E {
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;
Expand Down
19 changes: 19 additions & 0 deletions pkg/analyzer/test/src/dart/resolution/mixin_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -1693,6 +1694,24 @@ mixin M {}
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 {}
Expand Down

0 comments on commit 9aff930

Please sign in to comment.