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

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

Issue 2638183002: Issue 28027. Move Null to the bottom in the Analyzer. (Closed)
Patch Set: Fixes for review comments. 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) 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.task.dart_test; 5 library analyzer.test.src.task.dart_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 8 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
9 import 'package:analyzer/dart/ast/token.dart'; 9 import 'package:analyzer/dart/ast/token.dart';
10 import 'package:analyzer/dart/ast/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 5300 matching lines...) Expand 10 before | Expand all | Expand 10 after
5311 A.y = /*severe:StaticTypeError*/"hi"; 5311 A.y = /*severe:StaticTypeError*/"hi";
5312 new A().x2 = "hi"; 5312 new A().x2 = "hi";
5313 new A().y2 = /*severe:StaticTypeError*/"hi"; 5313 new A().y2 = /*severe:StaticTypeError*/"hi";
5314 } 5314 }
5315 '''); 5315 ''');
5316 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT11); 5316 computeResult(new LibrarySpecificUnit(source, source), RESOLVED_UNIT11);
5317 CompilationUnit unit = outputs[RESOLVED_UNIT11]; 5317 CompilationUnit unit = outputs[RESOLVED_UNIT11];
5318 5318
5319 InterfaceType intType = context.typeProvider.intType; 5319 InterfaceType intType = context.typeProvider.intType;
5320 InterfaceType stringType = context.typeProvider.stringType; 5320 InterfaceType stringType = context.typeProvider.stringType;
5321 DartType bottomType = context.typeProvider.bottomType; 5321 DartType nullType = context.typeProvider.nullType;
5322 DartType dynamicType = context.typeProvider.dynamicType; 5322 DartType dynamicType = context.typeProvider.dynamicType;
5323 5323
5324 assertVariableDeclarationTypes( 5324 assertVariableDeclarationTypes(
5325 AstFinder.getTopLevelVariable(unit, "x"), dynamicType, bottomType); 5325 AstFinder.getTopLevelVariable(unit, "x"), dynamicType, nullType);
5326 assertVariableDeclarationTypes( 5326 assertVariableDeclarationTypes(
5327 AstFinder.getTopLevelVariable(unit, "y"), intType, intType); 5327 AstFinder.getTopLevelVariable(unit, "y"), intType, intType);
5328 assertVariableDeclarationTypes( 5328 assertVariableDeclarationTypes(
5329 AstFinder.getFieldInClass(unit, "A", "x"), dynamicType, bottomType); 5329 AstFinder.getFieldInClass(unit, "A", "x"), dynamicType, nullType);
5330 assertVariableDeclarationTypes( 5330 assertVariableDeclarationTypes(
5331 AstFinder.getFieldInClass(unit, "A", "y"), intType, intType); 5331 AstFinder.getFieldInClass(unit, "A", "y"), intType, intType);
5332 assertVariableDeclarationTypes( 5332 assertVariableDeclarationTypes(
5333 AstFinder.getFieldInClass(unit, "A", "x2"), dynamicType, bottomType); 5333 AstFinder.getFieldInClass(unit, "A", "x2"), dynamicType, nullType);
5334 assertVariableDeclarationTypes( 5334 assertVariableDeclarationTypes(
5335 AstFinder.getFieldInClass(unit, "A", "y2"), intType, intType); 5335 AstFinder.getFieldInClass(unit, "A", "y2"), intType, intType);
5336 5336
5337 List<Statement> statements = 5337 List<Statement> statements =
5338 AstFinder.getStatementsInTopLevelFunction(unit, "test"); 5338 AstFinder.getStatementsInTopLevelFunction(unit, "test");
5339 5339
5340 assertAssignmentStatementTypes(statements[0], dynamicType, stringType); 5340 assertAssignmentStatementTypes(statements[0], dynamicType, stringType);
5341 assertAssignmentStatementTypes(statements[1], intType, stringType); 5341 assertAssignmentStatementTypes(statements[1], intType, stringType);
5342 assertAssignmentStatementTypes(statements[2], dynamicType, stringType); 5342 assertAssignmentStatementTypes(statements[2], dynamicType, stringType);
5343 assertAssignmentStatementTypes(statements[3], intType, stringType); 5343 assertAssignmentStatementTypes(statements[3], intType, stringType);
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
5729 /** 5729 /**
5730 * Fill [errorListener] with [result] errors in the current [task]. 5730 * Fill [errorListener] with [result] errors in the current [task].
5731 */ 5731 */
5732 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 5732 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
5733 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>; 5733 List<AnalysisError> errors = task.outputs[result] as List<AnalysisError>;
5734 expect(errors, isNotNull, reason: result.name); 5734 expect(errors, isNotNull, reason: result.name);
5735 errorListener = new GatheringErrorListener(); 5735 errorListener = new GatheringErrorListener();
5736 errorListener.addAll(errors); 5736 errorListener.addAll(errors);
5737 } 5737 }
5738 } 5738 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698