Skip to content

Commit c9efa47

Browse files
Remove instrumentTopLevelInference as it is redundant with expectation files
Change-Id: I1ce14796ba7d6976ae209f90f7c5f09226f3728e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97300 Commit-Queue: Peter von der Ahé <[email protected]> Reviewed-by: Aske Simon Christensen <[email protected]>
1 parent 57ac8b1 commit c9efa47

File tree

283 files changed

+848
-917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

283 files changed

+848
-917
lines changed

pkg/front_end/lib/src/fasta/builder/declaration.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,4 @@ abstract class Declaration {
8383
/// Resolve constructors (lookup names in scope) recorded in this builder and
8484
/// return the number of constructors resolved.
8585
int resolveConstructors(covariant Declaration parent) => 0;
86-
87-
void instrumentTopLevelInference(covariant instrumentation) {}
8886
}

pkg/front_end/lib/src/fasta/kernel/kernel_field_builder.dart

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ library fasta.kernel_field_builder;
77
import 'package:kernel/ast.dart'
88
show Class, DartType, DynamicType, Expression, Field, Name, NullLiteral;
99

10-
import '../../base/instrumentation.dart'
11-
show Instrumentation, InstrumentationValueForType;
12-
1310
import '../fasta_codes.dart' show messageInternalProblemAlreadyInitialized;
1411

1512
import '../problems.dart' show internalProblem, unsupported;
@@ -115,14 +112,6 @@ class KernelFieldBuilder extends FieldBuilder<Expression> {
115112
}
116113
}
117114

118-
@override
119-
void instrumentTopLevelInference(Instrumentation instrumentation) {
120-
if (isEligibleForInference) {
121-
instrumentation.record(field.fileUri, field.fileOffset, 'topType',
122-
new InstrumentationValueForType(field.type));
123-
}
124-
}
125-
126115
@override
127116
DartType get builtType => field.type;
128117
}

pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ import 'package:kernel/ast.dart'
3535

3636
import 'package:kernel/type_algebra.dart' show containsTypeVariable, substitute;
3737

38-
import '../../base/instrumentation.dart'
39-
show Instrumentation, InstrumentationValueForType;
40-
4138
import '../loader.dart' show Loader;
4239

4340
import '../messages.dart'
@@ -366,26 +363,6 @@ class KernelProcedureBuilder extends KernelFunctionBuilder {
366363

367364
Procedure get target => origin.procedure;
368365

369-
@override
370-
void instrumentTopLevelInference(Instrumentation instrumentation) {
371-
bool isEligibleForTopLevelInference = this.isEligibleForTopLevelInference;
372-
if ((isEligibleForTopLevelInference || isSetter) && returnType == null) {
373-
instrumentation.record(procedure.fileUri, procedure.fileOffset, 'topType',
374-
new InstrumentationValueForType(procedure.function.returnType));
375-
}
376-
if (isEligibleForTopLevelInference) {
377-
if (formals != null) {
378-
for (var formal in formals) {
379-
if (formal.type == null) {
380-
VariableDeclaration formalTarget = formal.target;
381-
instrumentation.record(procedure.fileUri, formalTarget.fileOffset,
382-
'topType', new InstrumentationValueForType(formalTarget.type));
383-
}
384-
}
385-
}
386-
}
387-
}
388-
389366
@override
390367
int finishPatch() {
391368
if (!isPatch) return 0;

pkg/front_end/lib/src/fasta/source/source_class_builder.dart

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ library fasta.source_class_builder;
77
import 'package:kernel/ast.dart'
88
show Class, Constructor, Member, Supertype, TreeNode;
99

10-
import '../../base/instrumentation.dart' show Instrumentation;
11-
1210
import '../dill/dill_member_builder.dart' show DillMemberBuilder;
1311

1412
import '../fasta_codes.dart'
@@ -258,13 +256,6 @@ class SourceClassBuilder extends KernelClassBuilder
258256
}
259257
}
260258

261-
@override
262-
void instrumentTopLevelInference(Instrumentation instrumentation) {
263-
scope.forEach((name, declaration) {
264-
declaration.instrumentTopLevelInference(instrumentation);
265-
});
266-
}
267-
268259
@override
269260
int finishPatch() {
270261
if (!isPatch) return 0;

pkg/front_end/lib/src/fasta/source/source_library_builder.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import 'package:kernel/ast.dart' show ProcedureKind;
88

99
import '../../base/resolve_relative_uri.dart' show resolveRelativeUri;
1010

11-
import '../../base/instrumentation.dart' show Instrumentation;
12-
1311
import '../../scanner/token.dart' show Token;
1412

1513
import '../builder/builder.dart'
@@ -880,14 +878,6 @@ abstract class SourceLibraryBuilder<T extends TypeBuilder, R>
880878
return name ?? "<library '$fileUri'>";
881879
}
882880

883-
@override
884-
void instrumentTopLevelInference(Instrumentation instrumentation) {
885-
Iterator<Declaration> iterator = this.iterator;
886-
while (iterator.moveNext()) {
887-
iterator.current.instrumentTopLevelInference(instrumentation);
888-
}
889-
}
890-
891881
@override
892882
void recordAccess(int charOffset, int length, Uri fileUri) {
893883
accessors.add(fileUri);

pkg/front_end/lib/src/fasta/source/source_loader.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -993,13 +993,6 @@ class SourceLoader extends Loader<Library> {
993993
}
994994

995995
typeInferenceEngine.finishTopLevelInitializingFormals();
996-
if (instrumentation != null) {
997-
builders.forEach((Uri uri, LibraryBuilder library) {
998-
if (library.loader == this) {
999-
library.instrumentTopLevelInference(instrumentation);
1000-
}
1001-
});
1002-
}
1003996
interfaceResolver = null;
1004997
// Since finalization of covariance may have added forwarding stubs, we need
1005998
// to recompute the class hierarchy so that method compilation will properly

pkg/front_end/lib/src/fasta/testing/validating_instrumentation.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class ValidatingInstrumentation implements Instrumentation {
3030
/// Map from feature names to the property names they are short for.
3131
static const _FEATURES = const {
3232
'inference': const [
33-
'topType',
3433
'typeArg',
3534
'typeArgs',
3635
'promotedType',

pkg/front_end/testcases/inference/async_closure_return_type_flatten.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ library test;
88
import 'dart:async';
99

1010
Future<int> futureInt = null;
11-
var /*@topType=() -> Future<int>*/ f = /*@returnType=Future<int>*/ () =>
12-
futureInt;
13-
var /*@topType=() -> Future<int>*/ g = /*@returnType=Future<int>*/ () async =>
14-
futureInt;
11+
var f = /*@returnType=Future<int>*/ () => futureInt;
12+
var g = /*@returnType=Future<int>*/ () async => futureInt;
1513

1614
main() {
1715
f;

pkg/front_end/testcases/inference/async_closure_return_type_future.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
/*@testedFeatures=inference*/
66
library test;
77

8-
var /*@topType=() -> Future<int>*/ f = /*@returnType=Future<int>*/ () async =>
9-
0;
8+
var f = /*@returnType=Future<int>*/ () async => 0;
109

1110
main() {
1211
f;

pkg/front_end/testcases/inference/async_closure_return_type_future_or.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ library test;
88
import 'dart:async';
99

1010
FutureOr<int> futureOrInt = null;
11-
var /*@topType=() -> FutureOr<int>*/ f = /*@returnType=FutureOr<int>*/ () =>
12-
futureOrInt;
13-
var /*@topType=() -> Future<int>*/ g = /*@returnType=Future<int>*/ () async =>
14-
futureOrInt;
11+
var f = /*@returnType=FutureOr<int>*/ () => futureOrInt;
12+
var g = /*@returnType=Future<int>*/ () async => futureOrInt;
1513

1614
main() {
1715
f;

pkg/front_end/testcases/inference/block_bodied_lambdas_downwards_incompatible_with_upwards_inference_top_level.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
library test;
77

88
String f() => null;
9-
var /*@topType=() -> String*/ g = f;
9+
var g = f;
1010

1111
main() {
1212
f;

pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*@testedFeatures=inference*/
66
library test;
77

8-
var /*@topType=dynamic*/ h = null;
8+
var h = null;
99
void foo(int f(Object _)) {}
1010

1111
test() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart:17:5: Context: Write to f@369
1+
pkg/front_end/testcases/inference/block_bodied_lambdas_infer_bottom_sync.dart:17:5: Context: Write to f@348
22
f = /*error:INVALID_CAST_FUNCTION_EXPR*/ /*@returnType=Null*/ (/*@type=Object*/ x) =>
33
^

pkg/front_end/testcases/inference/bottom.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*@testedFeatures=inference*/
66
library test;
77

8-
var /*@topType=dynamic*/ v = null;
8+
var v = null;
99

1010
main() {
1111
v;

pkg/front_end/testcases/inference/bottom_in_closure.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*@testedFeatures=inference*/
66
library test;
77

8-
var /*@topType=() -> Null*/ v = /*@returnType=Null*/ () => null;
8+
var v = /*@returnType=Null*/ () => null;
99

1010
main() {
1111
v;

pkg/front_end/testcases/inference/bug30251.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ library test;
88
T f<T>(T t) => t;
99

1010
class C {
11-
final /*@topType=dynamic*/ x;
11+
final x;
1212
C(int p) : x = /*@typeArgs=int*/ f(1 /*@target=num::+*/ + p);
1313
}
1414

pkg/front_end/testcases/inference/bug31132.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ library test;
88
class B {}
99

1010
class C extends B {
11-
var /*@topType=dynamic*/ z;
11+
var z;
1212
}
1313

1414
void test(B x) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pkg/front_end/testcases/inference/bug31132.dart:15:25: Context: Possible promotion of x@339
1+
pkg/front_end/testcases/inference/bug31132.dart:15:25: Context: Possible promotion of x@318
22
var /*@type=C*/ y = x is C ? /*@promotedType=C*/ x : new C();
33
^^

pkg/front_end/testcases/inference/circular_method_inference.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ library test;
1010
// that causes type inference for the method `f` to go into an infinite loop.
1111

1212
abstract class A extends B {
13-
/*@topType=dynamic*/ f(/*@topType=dynamic*/ x);
13+
f(x);
1414
}
1515

1616
abstract class B extends A {
17-
/*@topType=dynamic*/ f(/*@topType=dynamic*/ x);
17+
f(x);
1818
}
1919

2020
main() {}

pkg/front_end/testcases/inference/circular_reference_via_closures.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*@testedFeatures=inference*/
66
library test;
77

8-
var /*@topType=invalid-type*/ x = /*@returnType=invalid-type*/ () => y;
9-
var /*@topType=invalid-type*/ y = /*@returnType=invalid-type*/ () => x;
8+
var x = /*@returnType=invalid-type*/ () => y;
9+
var y = /*@returnType=invalid-type*/ () => x;
1010

1111
main() {}

pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ library test;
22
//
33
// Problems in library:
44
//
5-
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:9:31: Error: Can't infer the type of 'y': circularity found during type inference.
5+
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
66
// Specify the type explicitly.
7-
// var /*@topType=invalid-type*/ y = /*@returnType=invalid-type*/ () => x;
8-
// ^
7+
// var y = /*@returnType=invalid-type*/ () => x;
8+
// ^
99
//
10-
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:31: Error: Can't infer the type of 'x': circularity found during type inference.
10+
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
1111
// Specify the type explicitly.
12-
// var /*@topType=invalid-type*/ x = /*@returnType=invalid-type*/ () => y;
13-
// ^
12+
// var x = /*@returnType=invalid-type*/ () => y;
13+
// ^
1414
//
1515
import self as self;
1616

pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.transformed.expect

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ library test;
22
//
33
// Problems in library:
44
//
5-
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:9:31: Error: Can't infer the type of 'y': circularity found during type inference.
5+
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
66
// Specify the type explicitly.
7-
// var /*@topType=invalid-type*/ y = /*@returnType=invalid-type*/ () => x;
8-
// ^
7+
// var y = /*@returnType=invalid-type*/ () => x;
8+
// ^
99
//
10-
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:31: Error: Can't infer the type of 'x': circularity found during type inference.
10+
// pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
1111
// Specify the type explicitly.
12-
// var /*@topType=invalid-type*/ x = /*@returnType=invalid-type*/ () => y;
13-
// ^
12+
// var x = /*@returnType=invalid-type*/ () => y;
13+
// ^
1414
//
1515
import self as self;
1616

pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/*@testedFeatures=inference*/
66
library test;
77

8-
var /*@topType=invalid-type*/ x = /*@returnType=invalid-type*/ () => y;
9-
var /*@topType=invalid-type*/ y = /*@returnType=invalid-type*/ () => x;
8+
var x = /*@returnType=invalid-type*/ () => y;
9+
var y = /*@returnType=invalid-type*/ () => x;
1010

1111
main() {}

pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ library test;
22
//
33
// Problems in library:
44
//
5-
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:9:31: Error: Can't infer the type of 'y': circularity found during type inference.
5+
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
66
// Specify the type explicitly.
7-
// var /*@topType=invalid-type*/ y = /*@returnType=invalid-type*/ () => x;
8-
// ^
7+
// var y = /*@returnType=invalid-type*/ () => x;
8+
// ^
99
//
10-
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:31: Error: Can't infer the type of 'x': circularity found during type inference.
10+
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
1111
// Specify the type explicitly.
12-
// var /*@topType=invalid-type*/ x = /*@returnType=invalid-type*/ () => y;
13-
// ^
12+
// var x = /*@returnType=invalid-type*/ () => y;
13+
// ^
1414
//
1515
import self as self;
1616

pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.transformed.expect

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ library test;
22
//
33
// Problems in library:
44
//
5-
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:9:31: Error: Can't infer the type of 'y': circularity found during type inference.
5+
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:9:5: Error: Can't infer the type of 'y': circularity found during type inference.
66
// Specify the type explicitly.
7-
// var /*@topType=invalid-type*/ y = /*@returnType=invalid-type*/ () => x;
8-
// ^
7+
// var y = /*@returnType=invalid-type*/ () => x;
8+
// ^
99
//
10-
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:31: Error: Can't infer the type of 'x': circularity found during type inference.
10+
// pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:5: Error: Can't infer the type of 'x': circularity found during type inference.
1111
// Specify the type explicitly.
12-
// var /*@topType=invalid-type*/ x = /*@returnType=invalid-type*/ () => y;
13-
// ^
12+
// var x = /*@returnType=invalid-type*/ () => y;
13+
// ^
1414
//
1515
import self as self;
1616

pkg/front_end/testcases/inference/conditional_lub.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ library test;
88
bool b = true;
99
int x = 0;
1010
double y = 0.0;
11-
var /*@topType=num*/ z = b ? x : y;
11+
var z = b ? x : y;
1212

1313
main() {
1414
var /*@type=num*/ z = b ? x : y;

pkg/front_end/testcases/inference/conflicting_fields.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class I {
1515
}
1616

1717
class B extends A implements I {
18-
get /*@topType=dynamic*/field1 => null;
19-
get /*@topType=dynamic*/field2 => null;
18+
get field1 => null;
19+
get field2 => null;
2020
}
2121

2222
main() {}

0 commit comments

Comments
 (0)