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

Side by Side Diff: pkg/analyzer/test/src/summary/resynthesize_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
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 test.src.serialization.elements_test; 5 library test.src.serialization.elements_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
9 import 'package:analyzer/dart/constant/value.dart'; 9 import 'package:analyzer/dart/constant/value.dart';
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 3100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3111 var typeA = library.definingCompilationUnit.getType('B').supertype; 3111 var typeA = library.definingCompilationUnit.getType('B').supertype;
3112 expect(typeA.element.source.shortName, 'foo_io.dart'); 3112 expect(typeA.element.source.shortName, 'foo_io.dart');
3113 } 3113 }
3114 3114
3115 test_exports() { 3115 test_exports() {
3116 addLibrarySource('/a.dart', 'library a;'); 3116 addLibrarySource('/a.dart', 'library a;');
3117 addLibrarySource('/b.dart', 'library b;'); 3117 addLibrarySource('/b.dart', 'library b;');
3118 checkLibrary('export "a.dart"; export "b.dart";'); 3118 checkLibrary('export "a.dart"; export "b.dart";');
3119 } 3119 }
3120 3120
3121 test_expr_invalid_typeParameter_asPrefix() {
3122 variablesWithNotConstInitializers.add('f');
3123 checkLibrary('''
3124 class C<T> {
3125 final f = T.k;
3126 }
3127 ''');
3128 }
3129
3121 test_field_covariant() { 3130 test_field_covariant() {
3122 checkLibrary(''' 3131 checkLibrary('''
3123 class C { 3132 class C {
3124 covariant int x; 3133 covariant int x;
3125 }'''); 3134 }''');
3126 } 3135 }
3127 3136
3128 test_field_documented() { 3137 test_field_documented() {
3129 checkLibrary(''' 3138 checkLibrary('''
3130 class C { 3139 class C {
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
4634 } 4643 }
4635 4644
4636 test_type_arguments_implicit() { 4645 test_type_arguments_implicit() {
4637 checkLibrary('Map m;'); 4646 checkLibrary('Map m;');
4638 } 4647 }
4639 4648
4640 test_type_dynamic() { 4649 test_type_dynamic() {
4641 checkLibrary('dynamic d;'); 4650 checkLibrary('dynamic d;');
4642 } 4651 }
4643 4652
4653 test_type_invalid_typeParameter_asPrefix() {
4654 checkLibrary(
4655 '''
4656 class C<T> {
4657 m(T.K p) {}
4658 }
4659 ''',
4660 allowErrors: true);
4661 }
4662
4644 test_type_reference_lib_to_lib() { 4663 test_type_reference_lib_to_lib() {
4645 checkLibrary('class C {} enum E { v } typedef F(); C c; E e; F f;'); 4664 checkLibrary('class C {} enum E { v } typedef F(); C c; E e; F f;');
4646 } 4665 }
4647 4666
4648 test_type_reference_lib_to_part() { 4667 test_type_reference_lib_to_part() {
4649 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();'); 4668 addSource('/a.dart', 'part of l; class C {} enum E { v } typedef F();');
4650 checkLibrary('library l; part "a.dart"; C c; E e; F f;'); 4669 checkLibrary('library l; part "a.dart"; C c; E e; F f;');
4651 } 4670 }
4652 4671
4653 test_type_reference_part_to_lib() { 4672 test_type_reference_part_to_lib() {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 fail('Unexpectedly tried to get unlinked summary for $uri'); 5096 fail('Unexpectedly tried to get unlinked summary for $uri');
5078 } 5097 }
5079 return serializedUnit; 5098 return serializedUnit;
5080 } 5099 }
5081 5100
5082 @override 5101 @override
5083 bool hasLibrarySummary(String uri) { 5102 bool hasLibrarySummary(String uri) {
5084 return true; 5103 return true;
5085 } 5104 }
5086 } 5105 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698