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

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

Issue 1967583002: Check bounds of type parameters of function type aliases. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.non_error_resolver_test; 5 library analyzer.test.generated.non_error_resolver_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/generated/engine.dart'; 9 import 'package:analyzer/src/generated/engine.dart';
10 import 'package:analyzer/src/generated/error.dart'; 10 import 'package:analyzer/src/generated/error.dart';
(...skipping 5094 matching lines...) Expand 10 before | Expand all | Expand 10 after
5105 Source source = addSource(r''' 5105 Source source = addSource(r'''
5106 class A {} 5106 class A {}
5107 class B extends A {} 5107 class B extends A {}
5108 class G<E extends A> {} 5108 class G<E extends A> {}
5109 f() { return new G<B>(); }'''); 5109 f() { return new G<B>(); }''');
5110 computeLibrarySourceErrors(source); 5110 computeLibrarySourceErrors(source);
5111 assertNoErrors(source); 5111 assertNoErrors(source);
5112 verify([source]); 5112 verify([source]);
5113 } 5113 }
5114 5114
5115 void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound() {
5116 Source source = addSource(r'''
5117 class A {}
5118 class B extends A {}
5119 typedef F<T extends A>();
5120 F<A> fa;
5121 F<B> fb;
5122 ''');
5123 computeLibrarySourceErrors(source);
5124 assertNoErrors(source);
5125 verify([source]);
5126 }
5127
5128 void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_noBound() {
5129 Source source = addSource(r'''
5130 typedef F<T>();
5131 F<int> f1;
5132 F<String> f2;
5133 ''');
5134 computeLibrarySourceErrors(source);
5135 assertNoErrors(source);
5136 verify([source]);
5137 }
5138
5115 void test_typeArgumentNotMatchingBounds_typeArgumentList_0() { 5139 void test_typeArgumentNotMatchingBounds_typeArgumentList_0() {
5116 Source source = addSource("abstract class A<T extends A>{}"); 5140 Source source = addSource("abstract class A<T extends A>{}");
5117 computeLibrarySourceErrors(source); 5141 computeLibrarySourceErrors(source);
5118 assertNoErrors(source); 5142 assertNoErrors(source);
5119 verify([source]); 5143 verify([source]);
5120 } 5144 }
5121 5145
5122 void test_typeArgumentNotMatchingBounds_typeArgumentList_1() { 5146 void test_typeArgumentNotMatchingBounds_typeArgumentList_1() {
5123 Source source = addSource("abstract class A<T extends A<A>>{}"); 5147 Source source = addSource("abstract class A<T extends A<A>>{}");
5124 computeLibrarySourceErrors(source); 5148 computeLibrarySourceErrors(source);
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
6068 reset(); 6092 reset();
6069 } 6093 }
6070 6094
6071 void _check_wrongNumberOfParametersForOperator1(String name) { 6095 void _check_wrongNumberOfParametersForOperator1(String name) {
6072 _check_wrongNumberOfParametersForOperator(name, "a"); 6096 _check_wrongNumberOfParametersForOperator(name, "a");
6073 } 6097 }
6074 6098
6075 CompilationUnit _getResolvedLibraryUnit(Source source) => 6099 CompilationUnit _getResolvedLibraryUnit(Source source) =>
6076 analysisContext.getResolvedCompilationUnit2(source, source); 6100 analysisContext.getResolvedCompilationUnit2(source, source);
6077 } 6101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698