Skip to content

Commit ee2efe8

Browse files
jensjohacommit-bot@chromium.org
authored andcommitted
[CFE] Add more incremental compiler tests, prepare for better invalidation strategy
Change-Id: I94a61b1fa9bab466a7fc09d873fc75dea6b3aeb1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124324 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Jens Johansen <[email protected]>
1 parent 5eaccc2 commit ee2efe8

16 files changed

Lines changed: 737 additions & 0 deletions
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
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.md file.
4+
5+
# Test that invalidating a part of a package works.
6+
7+
type: newworld
8+
worlds:
9+
- entry: "package:example/main.dart"
10+
sources:
11+
pkg/example/main.dart: |
12+
part "b.dart";
13+
main() {
14+
print("hello");
15+
b();
16+
}
17+
pkg/example/b.dart: |
18+
part of "main.dart";
19+
b() {
20+
print("b1");
21+
}
22+
.packages: example:pkg/example
23+
expectedLibraryCount: 1
24+
- entry: "package:example/main.dart"
25+
worldType: updated
26+
expectInitializeFromDill: false
27+
invalidate:
28+
- pkg/example/b.dart
29+
expectedInvalidatedUri:
30+
- "package:example/b.dart"
31+
sources:
32+
pkg/example/b.dart: |
33+
part of "main.dart";
34+
b() {
35+
print("b2");
36+
}
37+
.packages: example:pkg/example
38+
expectedLibraryCount: 1
39+
- entry: "package:example/main.dart"
40+
worldType: updated
41+
expectInitializeFromDill: false
42+
invalidate:
43+
- "package:example/b.dart"
44+
expectedInvalidatedUri:
45+
- "package:example/b.dart"
46+
sources:
47+
pkg/example/b.dart: |
48+
part of "main.dart";
49+
b() {
50+
print("b3");
51+
}
52+
.packages: example:pkg/example
53+
expectedLibraryCount: 1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
main = <No Member>;
2+
library from "package:example/main.dart" as main {
3+
4+
part b.dart;
5+
static method /* from org-dartlang-test:///pkg/example/b.dart */ b() → dynamic {
6+
dart.core::print("b1");
7+
}
8+
static method main() → dynamic {
9+
dart.core::print("hello");
10+
main::b();
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
main = <No Member>;
2+
library from "package:example/main.dart" as main {
3+
4+
part b.dart;
5+
static method /* from org-dartlang-test:///pkg/example/b.dart */ b() → dynamic {
6+
dart.core::print("b2");
7+
}
8+
static method main() → dynamic {
9+
dart.core::print("hello");
10+
main::b();
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
main = <No Member>;
2+
library from "package:example/main.dart" as main {
3+
4+
part b.dart;
5+
static method /* from org-dartlang-test:///pkg/example/b.dart */ b() → dynamic {
6+
dart.core::print("b3");
7+
}
8+
static method main() → dynamic {
9+
dart.core::print("hello");
10+
main::b();
11+
}
12+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
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.md file.
4+
5+
# Compile an application, change a file, but don't change the outline.
6+
7+
type: newworld
8+
worlds:
9+
- entry: actualMain.dart
10+
sources:
11+
actualMain.dart: |
12+
import 'main.dart' as m;
13+
main() {
14+
m.main();
15+
}
16+
main.dart: |
17+
import 'libA.dart';
18+
19+
main() {
20+
whatever();
21+
}
22+
mainHello() {}
23+
libA.dart: |
24+
import 'main.dart';
25+
import 'libB.dart';
26+
class Foo {}
27+
whatever() {
28+
Bar bar = new Bar(new Foo());
29+
mainHello();
30+
}
31+
libB.dart: |
32+
import 'libA.dart';
33+
class Bar {
34+
Foo foo;
35+
Bar(this.foo);
36+
}
37+
expectedLibraryCount: 4
38+
- entry: actualMain.dart
39+
worldType: updated
40+
expectInitializeFromDill: false
41+
invalidate:
42+
- main.dart
43+
sources:
44+
main.dart: |
45+
import 'libA.dart';
46+
47+
main() {
48+
whatever();
49+
mainHello();
50+
}
51+
mainHello() {}
52+
expectedLibraryCount: 4
53+
expectsRebuildBodiesOnly: true
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
main = <No Member>;
2+
library from "org-dartlang-test:///actualMain.dart" as act {
3+
4+
import "org-dartlang-test:///main.dart" as m;
5+
6+
static method main() → dynamic {
7+
main::main();
8+
}
9+
}
10+
library from "org-dartlang-test:///libA.dart" as libA {
11+
12+
import "org-dartlang-test:///main.dart";
13+
import "org-dartlang-test:///libB.dart";
14+
15+
class Foo extends dart.core::Object {
16+
synthetic constructor •() → libA::Foo*
17+
: super dart.core::Object::•()
18+
;
19+
}
20+
static method whatever() → dynamic {
21+
libB::Bar* bar = new libB::Bar::•(new libA::Foo::•());
22+
main::mainHello();
23+
}
24+
}
25+
library from "org-dartlang-test:///libB.dart" as libB {
26+
27+
import "org-dartlang-test:///libA.dart";
28+
29+
class Bar extends dart.core::Object {
30+
field libA::Foo* foo;
31+
constructor •(libA::Foo* foo) → libB::Bar*
32+
: libB::Bar::foo = foo, super dart.core::Object::•()
33+
;
34+
}
35+
}
36+
library from "org-dartlang-test:///main.dart" as main {
37+
38+
import "org-dartlang-test:///libA.dart";
39+
40+
static method main() → dynamic {
41+
libA::whatever();
42+
}
43+
static method mainHello() → dynamic {}
44+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
main = <No Member>;
2+
library from "org-dartlang-test:///actualMain.dart" as act {
3+
4+
import "org-dartlang-test:///main.dart" as m;
5+
6+
static method main() → dynamic {
7+
main::main();
8+
}
9+
}
10+
library from "org-dartlang-test:///libA.dart" as libA {
11+
12+
import "org-dartlang-test:///main.dart";
13+
import "org-dartlang-test:///libB.dart";
14+
15+
class Foo extends dart.core::Object {
16+
synthetic constructor •() → libA::Foo*
17+
: super dart.core::Object::•()
18+
;
19+
}
20+
static method whatever() → dynamic {
21+
libB::Bar* bar = new libB::Bar::•(new libA::Foo::•());
22+
main::mainHello();
23+
}
24+
}
25+
library from "org-dartlang-test:///libB.dart" as libB {
26+
27+
import "org-dartlang-test:///libA.dart";
28+
29+
class Bar extends dart.core::Object {
30+
field libA::Foo* foo;
31+
constructor •(libA::Foo* foo) → libB::Bar*
32+
: libB::Bar::foo = foo, super dart.core::Object::•()
33+
;
34+
}
35+
}
36+
library from "org-dartlang-test:///main.dart" as main {
37+
38+
import "org-dartlang-test:///libA.dart";
39+
40+
static method main() → dynamic {
41+
libA::whatever();
42+
main::mainHello();
43+
}
44+
static method mainHello() → dynamic {}
45+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
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.md file.
4+
5+
# Compile an application, change a file, but don't change the outline.
6+
7+
type: newworld
8+
worlds:
9+
- entry: main.dart
10+
sources:
11+
main.dart: |
12+
import 'libA.dart';
13+
14+
class Foo {
15+
final message;
16+
Foo(this.message);
17+
@override
18+
toString() { return '$message'; }
19+
}
20+
21+
main() {
22+
Foo foo = new Foo("hello");
23+
whatever(foo);
24+
CompilationStrategy compilationStrategy = CompilationStrategy.direct;
25+
print(compilationStrategy);
26+
}
27+
28+
enum CompilationStrategy { direct, toKernel, toData, fromData }
29+
libA.dart: |
30+
import 'main.dart';
31+
whatever(Foo foo) {
32+
print(foo);
33+
}
34+
expectedLibraryCount: 2
35+
- entry: main.dart
36+
worldType: updated
37+
expectInitializeFromDill: false
38+
invalidate:
39+
- main.dart
40+
sources:
41+
main.dart: |
42+
import 'libA.dart';
43+
44+
class Foo {
45+
final message;
46+
Foo(this.message);
47+
@override
48+
toString() { return '$message!'; }
49+
}
50+
51+
main() {
52+
Foo foo = new Foo("hello");
53+
whatever(foo);
54+
CompilationStrategy compilationStrategy = CompilationStrategy.direct;
55+
print(compilationStrategy);
56+
}
57+
58+
enum CompilationStrategy { direct, toKernel, toData, fromData }
59+
expectedLibraryCount: 2
60+
expectsRebuildBodiesOnly: true
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
main = <No Member>;
2+
library from "org-dartlang-test:///libA.dart" as libA {
3+
4+
import "org-dartlang-test:///main.dart";
5+
6+
static method whatever(main::Foo* foo) → dynamic {
7+
dart.core::print(foo);
8+
}
9+
}
10+
library from "org-dartlang-test:///main.dart" as main {
11+
12+
import "org-dartlang-test:///libA.dart";
13+
14+
class Foo extends dart.core::Object {
15+
final field dynamic message;
16+
constructor •(dynamic message) → main::Foo*
17+
: main::Foo::message = message, super dart.core::Object::•()
18+
;
19+
@#C1
20+
method toString() → dart.core::String* {
21+
return "${this.{main::Foo::message}}";
22+
}
23+
}
24+
class CompilationStrategy extends dart.core::Object {
25+
final field dart.core::int* index;
26+
final field dart.core::String* _name;
27+
static const field dart.core::List<main::CompilationStrategy*>* values = #C14;
28+
static const field main::CompilationStrategy* direct = #C4;
29+
static const field main::CompilationStrategy* toKernel = #C7;
30+
static const field main::CompilationStrategy* toData = #C10;
31+
static const field main::CompilationStrategy* fromData = #C13;
32+
const constructor •(dart.core::int* index, dart.core::String* _name) → main::CompilationStrategy*
33+
: main::CompilationStrategy::index = index, main::CompilationStrategy::_name = _name, super dart.core::Object::•()
34+
;
35+
method toString() → dart.core::String*
36+
return this.{=main::CompilationStrategy::_name};
37+
}
38+
static method main() → dynamic {
39+
main::Foo* foo = new main::Foo::•("hello");
40+
libA::whatever(foo);
41+
main::CompilationStrategy* compilationStrategy = #C4;
42+
dart.core::print(compilationStrategy);
43+
}
44+
}
45+
constants {
46+
#C1 = dart.core::_Override {}
47+
#C2 = 0
48+
#C3 = "CompilationStrategy.direct"
49+
#C4 = main::CompilationStrategy {index:#C2, _name:#C3}
50+
#C5 = 1
51+
#C6 = "CompilationStrategy.toKernel"
52+
#C7 = main::CompilationStrategy {index:#C5, _name:#C6}
53+
#C8 = 2
54+
#C9 = "CompilationStrategy.toData"
55+
#C10 = main::CompilationStrategy {index:#C8, _name:#C9}
56+
#C11 = 3
57+
#C12 = "CompilationStrategy.fromData"
58+
#C13 = main::CompilationStrategy {index:#C11, _name:#C12}
59+
#C14 = <main::CompilationStrategy*>[#C4, #C7, #C10, #C13]
60+
}

0 commit comments

Comments
 (0)