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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 2658303002: Relax type bound restrictions slightly, apply to typedefs. (Closed)
Patch Set: Typing fix 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 | « no previous file | pkg/analyzer/test/generated/strong_mode_test.dart » ('j') | 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) 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.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 5221 matching lines...) Expand 10 before | Expand all | Expand 10 after
5232 } 5232 }
5233 5233
5234 void _checkForNotInstantiatedBound(TypeAnnotation node) { 5234 void _checkForNotInstantiatedBound(TypeAnnotation node) {
5235 if (!_options.strongMode || node == null) { 5235 if (!_options.strongMode || node == null) {
5236 return; 5236 return;
5237 } 5237 }
5238 5238
5239 if (node is TypeName) { 5239 if (node is TypeName) {
5240 if (node.typeArguments == null) { 5240 if (node.typeArguments == null) {
5241 DartType type = node.type; 5241 DartType type = node.type;
5242 if (type is InterfaceType && type.element.typeParameters.isNotEmpty) { 5242 if (type is ParameterizedType) {
Leaf 2017/01/27 23:24:06 This change is to make this apply to typedefs.
5243 _errorReporter.reportErrorForNode( 5243 Element element = type.element;
5244 StrongModeCode.NOT_INSTANTIATED_BOUND, node, [type]); 5244 if (element is TypeParameterizedElement &&
5245 element.typeParameters.any((p) => p.bound != null)) {
Leaf 2017/01/27 23:24:06 This change is to allow class A<T> {} class B<T
5246 _errorReporter.reportErrorForNode(
5247 StrongModeCode.NOT_INSTANTIATED_BOUND, node, [type]);
5248 }
5245 } 5249 }
5246 } else { 5250 } else {
5247 node.typeArguments.arguments.forEach(_checkForNotInstantiatedBound); 5251 node.typeArguments.arguments.forEach(_checkForNotInstantiatedBound);
5248 } 5252 }
5249 } else { 5253 } else {
5250 throw new UnimplementedError('${node.runtimeType}'); 5254 throw new UnimplementedError('${node.runtimeType}');
5251 } 5255 }
5252 } 5256 }
5253 5257
5254 /** 5258 /**
(...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after
7059 class _InvocationCollector extends RecursiveAstVisitor { 7063 class _InvocationCollector extends RecursiveAstVisitor {
7060 final List<String> superCalls = <String>[]; 7064 final List<String> superCalls = <String>[];
7061 7065
7062 @override 7066 @override
7063 visitMethodInvocation(MethodInvocation node) { 7067 visitMethodInvocation(MethodInvocation node) {
7064 if (node.target is SuperExpression) { 7068 if (node.target is SuperExpression) {
7065 superCalls.add(node.methodName.name); 7069 superCalls.add(node.methodName.name);
7066 } 7070 }
7067 } 7071 }
7068 } 7072 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/strong_mode_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698