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

Side by Side Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 1635213003: Test some additional corner cases of type inference for summaries. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.src.summary.summary_common; 5 library analyzer.test.src.summary.summary_common;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
(...skipping 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after
3731 3731
3732 test_import_uri() { 3732 test_import_uri() {
3733 String uriString = '"dart:async"'; 3733 String uriString = '"dart:async"';
3734 String libraryText = 'import $uriString; Future x;'; 3734 String libraryText = 'import $uriString; Future x;';
3735 serializeLibraryText(libraryText); 3735 serializeLibraryText(libraryText);
3736 // Second import is the implicit import of dart:core 3736 // Second import is the implicit import of dart:core
3737 expect(unlinkedUnits[0].imports, hasLength(2)); 3737 expect(unlinkedUnits[0].imports, hasLength(2));
3738 expect(unlinkedUnits[0].imports[0].uri, 'dart:async'); 3738 expect(unlinkedUnits[0].imports[0].uri, 'dart:async');
3739 } 3739 }
3740 3740
3741 test_inferred_type_refers_to_bound_type_param() {
3742 if (!strongMode || skipFullyLinkedData) {
3743 return;
3744 }
3745 UnlinkedClass cls = serializeClassText(
3746 'class C<T> extends D<int, T> { var v; }'
3747 ' abstract class D<U, V> { Map<V, U> get v; }',
3748 className: 'C');
3749 EntityRef type = getTypeRefForSlot(cls.fields[0].inferredTypeSlot);
3750 // Check that v has inferred type Map<T, int>.
3751 checkLinkedTypeRef(type, 'dart:core', 'dart:core', 'Map',
3752 allowTypeParameters: true, numTypeParameters: 2);
3753 checkParamTypeRef(type.typeArguments[0], 1);
3754 checkLinkedTypeRef(type.typeArguments[1], 'dart:core', 'dart:core', 'int');
3755 }
3756
3741 test_invalid_prefix_dynamic() { 3757 test_invalid_prefix_dynamic() {
3742 if (checkAstDerivedData) { 3758 if (checkAstDerivedData) {
3743 // TODO(paulberry): get this to work properly. 3759 // TODO(paulberry): get this to work properly.
3744 return; 3760 return;
3745 } 3761 }
3746 checkUnresolvedTypeRef( 3762 checkUnresolvedTypeRef(
3747 serializeTypeText('dynamic.T', allowErrors: true), 'dynamic', 'T'); 3763 serializeTypeText('dynamic.T', allowErrors: true), 'dynamic', 'T');
3748 } 3764 }
3749 3765
3750 test_invalid_prefix_type_parameter() { 3766 test_invalid_prefix_type_parameter() {
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
4701 */ 4717 */
4702 class _PrefixExpectation { 4718 class _PrefixExpectation {
4703 final ReferenceKind kind; 4719 final ReferenceKind kind;
4704 final String name; 4720 final String name;
4705 final bool inLibraryDefiningUnit; 4721 final bool inLibraryDefiningUnit;
4706 final int numTypeParameters; 4722 final int numTypeParameters;
4707 4723
4708 _PrefixExpectation(this.kind, this.name, 4724 _PrefixExpectation(this.kind, this.name,
4709 {this.inLibraryDefiningUnit: false, this.numTypeParameters: 0}); 4725 {this.inLibraryDefiningUnit: false, this.numTypeParameters: 0});
4710 } 4726 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698