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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1534033004: Use READY_RESOLVED_UNIT flag for ordering tasks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index fd4fee224db9f1cb3136abcb1b00417dd3562528..d681ae5c87b898f173ad801482e88924d6d7b630 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -3411,6 +3411,7 @@ class ResolveInstanceFieldsInUnitTaskTest extends _AbstractDartTaskTest {
'''
});
DartType dynamicType = context.typeProvider.dynamicType;
+ DartType intType = context.typeProvider.intType;
computeResult(
new LibrarySpecificUnit(sources[0], sources[0]), RESOLVED_UNIT8);
@@ -3425,7 +3426,7 @@ class ResolveInstanceFieldsInUnitTaskTest extends _AbstractDartTaskTest {
// A.a2 should now be fully resolved and inferred.
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit0, "A", "a2"), dynamicType, dynamicType);
+ AstFinder.getFieldInClass(unit0, "A", "a2"), dynamicType, intType);
}
// Test inference of instance fields across units with cycles
@@ -3537,7 +3538,7 @@ class ResolveInstanceFieldsInUnitTaskTest extends _AbstractDartTaskTest {
// A.a2 should now be fully resolved and inferred.
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit0, "A", "a2"), dynamicType, dynamicType);
+ AstFinder.getFieldInClass(unit0, "A", "a2"), dynamicType, intType);
// B.b2 should now be fully resolved and inferred.
assertVariableDeclarationTypes(
@@ -4004,17 +4005,17 @@ var tau = piFirst ? pi * 2 : 6.28;
// Test that local variables in method bodies are inferred appropriately
void test_perform_inference_cross_unit_instance() {
List<Source> sources = newSources({
+ '/b.dart': '''
+ class B {
+ final b2 = 1;
+ }
+ ''',
'/a.dart': '''
import 'b.dart';
class A {
final a2 = new B().b2;
}
''',
- '/b.dart': '''
- class B {
- final b2 = 1;
- }
- ''',
'/main.dart': '''
import "a.dart";
@@ -4033,10 +4034,10 @@ var tau = piFirst ? pi * 2 : 6.28;
InterfaceType intType = context.typeProvider.intType;
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit0, "A", "a2"), intType, intType);
+ AstFinder.getFieldInClass(unit0, "B", "b2"), intType, intType);
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit1, "B", "b2"), intType, intType);
+ AstFinder.getFieldInClass(unit1, "A", "a2"), intType, intType);
List<Statement> statements =
AstFinder.getStatementsInTopLevelFunction(unit2, "test1");
@@ -4047,13 +4048,6 @@ var tau = piFirst ? pi * 2 : 6.28;
// Test inference interactions between local variables and fields
void test_perform_inference_cross_unit_instance_member() {
List<Source> sources = newSources({
- '/a.dart': '''
- import 'b.dart';
- var bar = new B();
- void foo() {
- String x = bar.f.z;
- }
- ''',
'/b.dart': '''
class C {
var z = 3;
@@ -4063,6 +4057,13 @@ var tau = piFirst ? pi * 2 : 6.28;
var f = new C();
}
''',
+ '/a.dart': '''
+ import 'b.dart';
+ var bar = new B();
+ void foo() {
+ String x = bar.f.z;
+ }
+ ''',
'/c.dart': '''
import 'b.dart';
var bar = new B();
@@ -4073,14 +4074,14 @@ var tau = piFirst ? pi * 2 : 6.28;
});
List<dynamic> units =
computeLibraryResults(sources, RESOLVED_UNIT10).toList();
- CompilationUnit unit0 = units[0];
+ CompilationUnit unit1 = units[1];
CompilationUnit unit2 = units[2];
InterfaceType intType = context.typeProvider.intType;
InterfaceType stringType = context.typeProvider.stringType;
assertVariableDeclarationStatementTypes(
- AstFinder.getStatementsInTopLevelFunction(unit0, "foo")[0],
+ AstFinder.getStatementsInTopLevelFunction(unit1, "foo")[0],
stringType,
intType);
assertVariableDeclarationStatementTypes(
@@ -4142,6 +4143,12 @@ var tau = piFirst ? pi * 2 : 6.28;
// Test that inference does not propagate from null
void test_perform_inference_cross_unit_static_instance() {
List<Source> sources = newSources({
+ '/b.dart': '''
+ class B {
+ static final b1 = 1;
+ final b2 = 1;
+ }
+ ''',
'/a.dart': '''
import 'b.dart';
class A {
@@ -4149,12 +4156,6 @@ var tau = piFirst ? pi * 2 : 6.28;
final a2 = new B().b2;
}
''',
- '/b.dart': '''
- class B {
- static final b1 = 1;
- final b2 = 1;
- }
- ''',
'/main.dart': '''
import "a.dart";
@@ -4175,14 +4176,14 @@ var tau = piFirst ? pi * 2 : 6.28;
InterfaceType intType = context.typeProvider.intType;
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit0, "A", "a1"), intType, intType);
+ AstFinder.getFieldInClass(unit0, "B", "b1"), intType, intType);
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit0, "A", "a2"), intType, intType);
+ AstFinder.getFieldInClass(unit0, "B", "b2"), intType, intType);
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit1, "B", "b1"), intType, intType);
+ AstFinder.getFieldInClass(unit1, "A", "a1"), intType, intType);
assertVariableDeclarationTypes(
- AstFinder.getFieldInClass(unit1, "B", "b2"), intType, intType);
+ AstFinder.getFieldInClass(unit1, "A", "a2"), intType, intType);
List<Statement> statements =
AstFinder.getStatementsInTopLevelFunction(unit2, "test1");

Powered by Google App Engine
This is Rietveld 408576698