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

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

Issue 1852883003: Fix summarizing of types with unused type parameters. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/summarize_ast_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/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 7935 matching lines...) Expand 10 before | Expand all | Expand 10 after
7946 7946
7947 test_unresolved_reference_shared() { 7947 test_unresolved_reference_shared() {
7948 // Both `x` and `y` use unresolved identifier `C` as their type. Verify 7948 // Both `x` and `y` use unresolved identifier `C` as their type. Verify
7949 // that they both use the same unresolved reference. 7949 // that they both use the same unresolved reference.
7950 serializeLibraryText('C x; C y;', allowErrors: true); 7950 serializeLibraryText('C x; C y;', allowErrors: true);
7951 EntityRef xType = findVariable('x').type; 7951 EntityRef xType = findVariable('x').type;
7952 EntityRef yType = findVariable('y').type; 7952 EntityRef yType = findVariable('y').type;
7953 expect(xType.reference, yType.reference); 7953 expect(xType.reference, yType.reference);
7954 } 7954 }
7955 7955
7956 test_unused_type_parameter() {
7957 if (skipFullyLinkedData) {
7958 return;
7959 }
7960 // Unused type parameters get converted to `dynamic`.
7961 UnlinkedVariable variable = serializeVariableText('''
7962 class C<T> {
7963 void f() {}
7964 }
7965 C<int> c;
7966 var v = c.f;
7967 ''');
7968 EntityRef type =
7969 getTypeRefForSlot(variable.initializer.inferredReturnTypeSlot);
7970 expect(type.typeArguments, hasLength(1));
7971 checkLinkedTypeRef(type.typeArguments[0], null, null, 'dynamic');
7972 }
7973
7956 test_variable() { 7974 test_variable() {
7957 String text = 'int i;'; 7975 String text = 'int i;';
7958 UnlinkedVariable v = serializeVariableText(text, variableName: 'i'); 7976 UnlinkedVariable v = serializeVariableText(text, variableName: 'i');
7959 expect(v.nameOffset, text.indexOf('i;')); 7977 expect(v.nameOffset, text.indexOf('i;'));
7960 expect(findExecutable('i'), isNull); 7978 expect(findExecutable('i'), isNull);
7961 expect(findExecutable('i='), isNull); 7979 expect(findExecutable('i='), isNull);
7962 expect(unlinkedUnits[0].publicNamespace.names, hasLength(2)); 7980 expect(unlinkedUnits[0].publicNamespace.names, hasLength(2));
7963 expect(unlinkedUnits[0].publicNamespace.names[0].kind, 7981 expect(unlinkedUnits[0].publicNamespace.names[0].kind,
7964 ReferenceKind.topLevelPropertyAccessor); 7982 ReferenceKind.topLevelPropertyAccessor);
7965 expect(unlinkedUnits[0].publicNamespace.names[0].name, 'i'); 7983 expect(unlinkedUnits[0].publicNamespace.names[0].name, 'i');
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
8291 class _PrefixExpectation { 8309 class _PrefixExpectation {
8292 final ReferenceKind kind; 8310 final ReferenceKind kind;
8293 final String name; 8311 final String name;
8294 final String absoluteUri; 8312 final String absoluteUri;
8295 final String relativeUri; 8313 final String relativeUri;
8296 final int numTypeParameters; 8314 final int numTypeParameters;
8297 8315
8298 _PrefixExpectation(this.kind, this.name, 8316 _PrefixExpectation(this.kind, this.name,
8299 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 8317 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
8300 } 8318 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/summarize_ast_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698