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

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

Issue 1602263002: Fix summarization of trailing `dynamic` type arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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_test; 5 library analyzer.test.src.summary.summary_test;
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 2770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'int'); 2781 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'int');
2782 } 2782 }
2783 2783
2784 test_type_arguments_explicit_dynamic() { 2784 test_type_arguments_explicit_dynamic() {
2785 UnlinkedTypeRef typeRef = serializeTypeText('List<dynamic>'); 2785 UnlinkedTypeRef typeRef = serializeTypeText('List<dynamic>');
2786 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'List', 2786 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'List',
2787 allowTypeParameters: true, numTypeParameters: 1); 2787 allowTypeParameters: true, numTypeParameters: 1);
2788 expect(typeRef.typeArguments, isEmpty); 2788 expect(typeRef.typeArguments, isEmpty);
2789 } 2789 }
2790 2790
2791 test_type_arguments_explicit_dynamic_dynamic() {
2792 UnlinkedTypeRef typeRef = serializeTypeText('Map<dynamic, dynamic>');
2793 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'Map',
2794 allowTypeParameters: true, numTypeParameters: 2);
2795 // Trailing type arguments of type `dynamic` are omitted.
2796 expect(typeRef.typeArguments, isEmpty);
2797 }
2798
2799 test_type_arguments_explicit_dynamic_int() {
2800 UnlinkedTypeRef typeRef = serializeTypeText('Map<dynamic, int>');
2801 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'Map',
2802 allowTypeParameters: true, numTypeParameters: 2);
2803 // Leading type arguments of type `dynamic` are not omitted.
2804 expect(typeRef.typeArguments.length, 2);
2805 checkDynamicTypeRef(typeRef.typeArguments[0]);
2806 checkTypeRef(typeRef.typeArguments[1], 'dart:core', 'dart:core', 'int');
2807 }
2808
2791 test_type_arguments_explicit_dynamic_typedef() { 2809 test_type_arguments_explicit_dynamic_typedef() {
2792 UnlinkedTypeRef typeRef = 2810 UnlinkedTypeRef typeRef =
2793 serializeTypeText('F<dynamic>', otherDeclarations: 'typedef T F<T>();'); 2811 serializeTypeText('F<dynamic>', otherDeclarations: 'typedef T F<T>();');
2794 checkTypeRef(typeRef, null, null, 'F', 2812 checkTypeRef(typeRef, null, null, 'F',
2795 allowTypeParameters: true, 2813 allowTypeParameters: true,
2796 expectedKind: ReferenceKind.typedef, 2814 expectedKind: ReferenceKind.typedef,
2797 numTypeParameters: 1); 2815 numTypeParameters: 1);
2798 expect(typeRef.typeArguments, isEmpty); 2816 expect(typeRef.typeArguments, isEmpty);
2799 } 2817 }
2800 2818
2819 test_type_arguments_explicit_String_dynamic() {
2820 UnlinkedTypeRef typeRef = serializeTypeText('Map<String, dynamic>');
2821 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'Map',
2822 allowTypeParameters: true, numTypeParameters: 2);
2823 // Trailing type arguments of type `dynamic` are omitted.
2824 expect(typeRef.typeArguments.length, 1);
2825 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'String');
2826 }
2827
2828 test_type_arguments_explicit_String_int() {
2829 UnlinkedTypeRef typeRef = serializeTypeText('Map<String, int>');
2830 checkTypeRef(typeRef, 'dart:core', 'dart:core', 'Map',
2831 allowTypeParameters: true, numTypeParameters: 2);
2832 expect(typeRef.typeArguments.length, 2);
2833 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'String');
2834 checkTypeRef(typeRef.typeArguments[1], 'dart:core', 'dart:core', 'int');
2835 }
2836
2801 test_type_arguments_explicit_typedef() { 2837 test_type_arguments_explicit_typedef() {
2802 UnlinkedTypeRef typeRef = 2838 UnlinkedTypeRef typeRef =
2803 serializeTypeText('F<int>', otherDeclarations: 'typedef T F<T>();'); 2839 serializeTypeText('F<int>', otherDeclarations: 'typedef T F<T>();');
2804 checkTypeRef(typeRef, null, null, 'F', 2840 checkTypeRef(typeRef, null, null, 'F',
2805 allowTypeParameters: true, 2841 allowTypeParameters: true,
2806 expectedKind: ReferenceKind.typedef, 2842 expectedKind: ReferenceKind.typedef,
2807 numTypeParameters: 1); 2843 numTypeParameters: 1);
2808 expect(typeRef.typeArguments, hasLength(1)); 2844 expect(typeRef.typeArguments, hasLength(1));
2809 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'int'); 2845 checkTypeRef(typeRef.typeArguments[0], 'dart:core', 'dart:core', 'int');
2810 } 2846 }
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 CompilationUnit _parseText(String text) { 3407 CompilationUnit _parseText(String text) {
3372 CharSequenceReader reader = new CharSequenceReader(text); 3408 CharSequenceReader reader = new CharSequenceReader(text);
3373 Scanner scanner = 3409 Scanner scanner =
3374 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER); 3410 new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER);
3375 Token token = scanner.tokenize(); 3411 Token token = scanner.tokenize();
3376 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER); 3412 Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
3377 parser.parseGenericMethods = true; 3413 parser.parseGenericMethods = true;
3378 return parser.parseCompilationUnit(token); 3414 return parser.parseCompilationUnit(token);
3379 } 3415 }
3380 } 3416 }
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