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

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

Issue 2668493002: Issue 28547. Fix for summarizing code with invalid type parameter reference. (Closed)
Patch Set: Handle invalid type parameter reference in expressions. Created 3 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_common.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/error/listener.dart'; 9 import 'package:analyzer/error/listener.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 7482 matching lines...) Expand 10 before | Expand all | Expand 10 after
7493 strings: [ 7493 strings: [
7494 'x', 7494 'x',
7495 'y', 7495 'y',
7496 'z' 7496 'z'
7497 ], 7497 ],
7498 assignmentOperators: [ 7498 assignmentOperators: [
7499 UnlinkedExprAssignOperator.assign 7499 UnlinkedExprAssignOperator.assign
7500 ]); 7500 ]);
7501 } 7501 }
7502 7502
7503 test_expr_invalid_typeParameter_asPrefix() {
7504 if (skipNonConstInitializers) {
7505 return;
7506 }
7507 var c = serializeClassText('''
7508 class C<T> {
7509 final f = T.k;
7510 }
7511 ''');
7512 assertUnlinkedConst(c.fields[0].initializer.bodyExpr,
7513 isValidConst: false, operators: []);
7514 }
7515
7503 test_expr_invokeMethod_instance() { 7516 test_expr_invokeMethod_instance() {
7504 if (skipNonConstInitializers) { 7517 if (skipNonConstInitializers) {
7505 return; 7518 return;
7506 } 7519 }
7507 UnlinkedVariable variable = serializeVariableText(''' 7520 UnlinkedVariable variable = serializeVariableText('''
7508 class C { 7521 class C {
7509 int m(a, {b, c}) => 42; 7522 int m(a, {b, c}) => 42;
7510 } 7523 }
7511 final v = new C().m(1, b: 2, c: 3); 7524 final v = new C().m(1, b: 2, c: 3);
7512 '''); 7525 ''');
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after
9881 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'Map', 9894 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'Map',
9882 numTypeParameters: 2, numTypeArguments: 2); 9895 numTypeParameters: 2, numTypeArguments: 2);
9883 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'int'); 9896 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'int');
9884 checkTypeRef(typeRef.typeArguments[1], 'dart:core', 'dart:core', 'Object'); 9897 checkTypeRef(typeRef.typeArguments[1], 'dart:core', 'dart:core', 'Object');
9885 } 9898 }
9886 9899
9887 test_type_dynamic() { 9900 test_type_dynamic() {
9888 checkDynamicTypeRef(serializeTypeText('dynamic')); 9901 checkDynamicTypeRef(serializeTypeText('dynamic'));
9889 } 9902 }
9890 9903
9904 test_type_invalid_typeParameter_asPrefix() {
9905 UnlinkedClass c = serializeClassText('''
9906 class C<T> {
9907 m(T.K p) {}
9908 }
9909 ''');
9910 UnlinkedExecutable m = c.executables[0];
9911 expect(m.name, 'm');
9912 checkTypeRef(m.parameters[0].type, null, null, 'dynamic');
9913 }
9914
9891 test_type_param_codeRange() { 9915 test_type_param_codeRange() {
9892 if (!includeInformative) return; 9916 if (!includeInformative) return;
9893 UnlinkedClass cls = 9917 UnlinkedClass cls =
9894 serializeClassText('class A {} class C<T extends A> {}'); 9918 serializeClassText('class A {} class C<T extends A> {}');
9895 UnlinkedTypeParam typeParameter = cls.typeParameters[0]; 9919 UnlinkedTypeParam typeParameter = cls.typeParameters[0];
9896 _assertCodeRange(typeParameter.codeRange, 19, 11); 9920 _assertCodeRange(typeParameter.codeRange, 19, 11);
9897 } 9921 }
9898 9922
9899 test_type_param_not_shadowed_by_constructor() { 9923 test_type_param_not_shadowed_by_constructor() {
9900 UnlinkedClass cls = 9924 UnlinkedClass cls =
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
10673 class _PrefixExpectation { 10697 class _PrefixExpectation {
10674 final ReferenceKind kind; 10698 final ReferenceKind kind;
10675 final String name; 10699 final String name;
10676 final String absoluteUri; 10700 final String absoluteUri;
10677 final String relativeUri; 10701 final String relativeUri;
10678 final int numTypeParameters; 10702 final int numTypeParameters;
10679 10703
10680 _PrefixExpectation(this.kind, this.name, 10704 _PrefixExpectation(this.kind, this.name,
10681 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 10705 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
10682 } 10706 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_common.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698