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

Side by Side Diff: pkg/analyzer/test/src/task/strong_mode_test.dart

Issue 1382403002: Clean up hints (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/task/dart_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 test.src.task.strong_mode_test; 5 library test.src.task.strong_mode_test;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/element.dart'; 8 import 'package:analyzer/src/generated/element.dart';
9 import 'package:analyzer/src/generated/source.dart'; 9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analyzer/src/task/strong_mode.dart'; 10 import 'package:analyzer/src/task/strong_mode.dart';
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 InstanceMemberInferrer inferrer = createInferrer; 245 InstanceMemberInferrer inferrer = createInferrer;
246 String fieldName = 'f'; 246 String fieldName = 'f';
247 CompilationUnitElement unit = resolve(''' 247 CompilationUnitElement unit = resolve('''
248 class A { 248 class A {
249 final $fieldName; 249 final $fieldName;
250 } 250 }
251 class B extends A { 251 class B extends A {
252 final $fieldName = 0; 252 final $fieldName = 0;
253 } 253 }
254 '''); 254 ''');
255 ClassElement classA = unit.getType('A');
256 FieldElement fieldA = classA.getField(fieldName);
257 PropertyAccessorElement getterA = classA.getGetter(fieldName);
258 ClassElement classB = unit.getType('B'); 255 ClassElement classB = unit.getType('B');
259 FieldElement fieldB = classB.getField(fieldName); 256 FieldElement fieldB = classB.getField(fieldName);
260 PropertyAccessorElement getterB = classB.getGetter(fieldName); 257 PropertyAccessorElement getterB = classB.getGetter(fieldName);
261 expect(fieldB.type.isDynamic, isTrue); 258 expect(fieldB.type.isDynamic, isTrue);
262 expect(getterB.returnType.isDynamic, isTrue); 259 expect(getterB.returnType.isDynamic, isTrue);
263 260
264 inferrer.inferCompilationUnit(unit); 261 inferrer.inferCompilationUnit(unit);
265 262
266 expect(fieldB.type, inferrer.typeProvider.intType); 263 expect(fieldB.type, inferrer.typeProvider.intType);
267 expect(getterB.returnType, fieldB.type); 264 expect(getterB.returnType, fieldB.type);
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 CompilationUnitElement unit = resolve(''' 554 CompilationUnitElement unit = resolve('''
558 class A { 555 class A {
559 int get $getterName => 0; 556 int get $getterName => 0;
560 set $getterName(String value) {} 557 set $getterName(String value) {}
561 } 558 }
562 class B extends A { 559 class B extends A {
563 set $getterName(x) {} 560 set $getterName(x) {}
564 } 561 }
565 '''); 562 ''');
566 ClassElement classA = unit.getType('A'); 563 ClassElement classA = unit.getType('A');
567 FieldElement fieldA = classA.getField(getterName);
568 PropertyAccessorElement setterA = classA.getSetter(getterName); 564 PropertyAccessorElement setterA = classA.getSetter(getterName);
569 ClassElement classB = unit.getType('B'); 565 ClassElement classB = unit.getType('B');
570 FieldElement fieldB = classB.getField(getterName); 566 FieldElement fieldB = classB.getField(getterName);
571 PropertyAccessorElement setterB = classB.getSetter(getterName); 567 PropertyAccessorElement setterB = classB.getSetter(getterName);
572 expect(fieldB.type.isDynamic, isTrue); 568 expect(fieldB.type.isDynamic, isTrue);
573 expect(setterB.parameters[0].type.isDynamic, isTrue); 569 expect(setterB.parameters[0].type.isDynamic, isTrue);
574 570
575 inferrer.inferCompilationUnit(unit); 571 inferrer.inferCompilationUnit(unit);
576 572
577 // Expected behavior is that the getter is inferred: getters and setters 573 // Expected behavior is that the getter is inferred: getters and setters
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 } 1040 }
1045 } 1041 }
1046 } 1042 }
1047 '''); 1043 ''');
1048 CompilationUnit unit = context.resolveCompilationUnit2(source, source); 1044 CompilationUnit unit = context.resolveCompilationUnit2(source, source);
1049 VariableGatherer gatherer = new VariableGatherer(filter); 1045 VariableGatherer gatherer = new VariableGatherer(filter);
1050 unit.accept(gatherer); 1046 unit.accept(gatherer);
1051 return gatherer.results; 1047 return gatherer.results;
1052 } 1048 }
1053 } 1049 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/task/dart_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698