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

Side by Side Diff: pkg/analyzer/test/generated/resolver_test_case.dart

Issue 2641213002: Issue 28100. In strong mode verify that TypeParameter bound has required type arguments. (Closed)
Patch Set: Created 3 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.generated.resolver_test_case; 5 library analyzer.test.generated.resolver_test_case;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 _expectType(initializer.propagatedType, propagatedType); 904 _expectType(initializer.propagatedType, propagatedType);
905 } 905 }
906 } 906 }
907 907
908 SimpleIdentifier findIdentifier(String search) { 908 SimpleIdentifier findIdentifier(String search) {
909 SimpleIdentifier identifier = EngineTestCase.findNode( 909 SimpleIdentifier identifier = EngineTestCase.findNode(
910 testUnit, testCode, search, (node) => node is SimpleIdentifier); 910 testUnit, testCode, search, (node) => node is SimpleIdentifier);
911 return identifier; 911 return identifier;
912 } 912 }
913 913
914 Future<Null> resolveTestUnit(String code) async { 914 Future<Null> resolveTestUnit(String code, {bool noErrors: true}) async {
915 testCode = code; 915 testCode = code;
916 testSource = addSource(testCode); 916 testSource = addSource(testCode);
917 TestAnalysisResult analysisResult = await computeAnalysisResult(testSource); 917 TestAnalysisResult analysisResult = await computeAnalysisResult(testSource);
918 assertNoErrors(testSource); 918 if (noErrors) {
919 assertNoErrors(testSource);
920 }
919 verify([testSource]); 921 verify([testSource]);
920 testUnit = analysisResult.unit; 922 testUnit = analysisResult.unit;
921 } 923 }
922 924
923 /** 925 /**
924 * Validates that [type] matches [expected]. 926 * Validates that [type] matches [expected].
925 * 927 *
926 * If [expected] is a string, validates that the type stringifies to that 928 * If [expected] is a string, validates that the type stringifies to that
927 * text. Otherwise, [expected] is used directly a [Matcher] to match the type. 929 * text. Otherwise, [expected] is used directly a [Matcher] to match the type.
928 */ 930 */
929 _expectType(DartType type, expected) { 931 _expectType(DartType type, expected) {
930 if (expected is String) { 932 if (expected is String) {
931 expect(type.toString(), expected); 933 expect(type.toString(), expected);
932 } else { 934 } else {
933 expect(type, expected); 935 expect(type, expected);
934 } 936 }
935 } 937 }
936 } 938 }
937 939
938 class TestAnalysisResult { 940 class TestAnalysisResult {
939 final Source source; 941 final Source source;
940 final CompilationUnit unit; 942 final CompilationUnit unit;
941 final List<AnalysisError> errors; 943 final List<AnalysisError> errors;
942 TestAnalysisResult(this.source, this.unit, this.errors); 944 TestAnalysisResult(this.source, this.unit, this.errors);
943 } 945 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698