Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5657acf

Browse files
munificentcommit-bot@chromium.org
authored andcommitted
Roll dart_style 2.1.0 into the SDK.
This only adds support for the new constructor tear-offs. No existing formatted code should be changed, so it should be safe to land this without coordinating a roll of the pre-built SDK. Change-Id: Ic3fd04f12ef5a1f67760d3edc78c5f419ba1c3c3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210285 Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Nate Bosch <nbosch@google.com>
1 parent cfb057d commit 5657acf

File tree

43 files changed

+423
-35
lines changed

Some content is hidden

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

43 files changed

+423
-35
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ vars = {
103103
# and land the review.
104104
#
105105
# For more details, see https://github.com/dart-lang/sdk/issues/30164
106-
"dart_style_rev": "06bfd19593ed84dd288f67e02c6a753e6516288a",
106+
"dart_style_rev": "14d9b6fd58cc4744676c12be3cc5eee2a779db82",
107107

108108
"dartdoc_rev" : "5f39ec674d81f5c199151d823fa4ecd01fc59eb2",
109109
"devtools_rev" : "64cffbed6366329ad05e44d48fa2298367643bb6",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
T func<T>(T value) => value;
22
int Function(int) f = funcValue.call;
3+
int Function(int) g = funcValue.call<int>;
34
main() {}
5+
test(Function f) {}
46
var funcValue = func;

pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline.expect

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class A<T> {
33
factory A.fact() => new A();
44
factory A.redirect() = A;
55
}
6+
67
typedef B<T> = A<T>;
78
typedef C<T> = A<int>;
89
const a = A.new;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
class A<T> {
2+
A();
3+
factory A.fact() => new A();
4+
factory A.redirect() = A;
5+
}
6+
7+
const a = A.new;
8+
const b = A<int>.new;
9+
const c = A.fact;
10+
const d = A<int>.fact;
11+
const e = A.redirect;
12+
const f = A<int>.redirect;
13+
const g = B.new;
14+
const h = B<int>.new;
15+
const i = B.fact;
16+
const j = B<int>.fact;
17+
const k = B.redirect;
18+
const l = B<int>.redirect;
19+
const m = C.new;
20+
const n = C<int>.new;
21+
const o = C.fact;
22+
const p = C<int>.fact;
23+
const q = C.redirect;
24+
const r = C<int>.redirect;
25+
main() {}
26+
typedef B<T> = A<T>;
27+
typedef C<T> = A<int>;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
main() {}
2+
test1(dynamic x) => x.foo<int>;
3+
test2(Never x) => x.foo<int>;
4+
test3(dynamic x) => x.toString<int>;
5+
test4(Never x) => x.toString<int>;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
X boundedMethod<X extends num>(X x) => x;
2+
X id<X>(X x) => x;
3+
main() {}
4+
test() {}
5+
var a = id;
6+
var b = a<int>;
7+
var c = id<int>;
8+
var d = id<int, String>;
9+
var e = method<int>;
10+
var f = 0<int>;
11+
var g = main<int>;
12+
var h = boundedMethod<String>;
13+
void method<X, Y>() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
class A {
22
A.new();
33
}
4+
45
class B {
56
B();
67
}
8+
79
class C {
810
C();
911
C.new();
1012
}
13+
1114
class D {
1215
D.new();
1316
D();
1417
}
18+
1519
class E1 {
1620
E1._();
1721
E1();
1822
factory E1.new() => E1._();
1923
}
24+
2025
class E2 {
2126
E2._();
2227
factory E2.new() => E2._();
2328
E2();
2429
}
30+
2531
class E3 {
2632
E3._();
2733
E3();
2834
factory E3.new() = E3._;
2935
}
36+
3037
class E4 {
3138
E4._();
3239
factory E4.new() = E4._;
3340
E4();
3441
}
42+
3543
main() {}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
class A {
2+
A.new();
3+
}
4+
5+
class B {
6+
B();
7+
}
8+
9+
class C {
10+
C();
11+
C.new();
12+
}
13+
14+
class D {
15+
D();
16+
D.new();
17+
}
18+
19+
class E1 {
20+
E1();
21+
E1._();
22+
factory E1.new() => E1._();
23+
}
24+
25+
class E2 {
26+
E2();
27+
E2._();
28+
factory E2.new() => E2._();
29+
}
30+
31+
class E3 {
32+
E3();
33+
E3._();
34+
factory E3.new() = E3._;
35+
}
36+
37+
class E4 {
38+
E4();
39+
E4._();
40+
factory E4.new() = E4._;
41+
}
42+
43+
main() {}

pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class A<X> {
44
A();
55
factory A.bar1() => new A();
66
}
7+
78
A<X> Function<X>(X) test1() => A.foo1;
89
A<X> Function<X>(X) test2() => A.foo2;
910
A<X> Function<X>(X) test3() => A.new;
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
1-
A<X> Function<X>(X) bar1() => A.foo1;
2-
A<X> Function<X>(X) bar2() => A.foo2;
1+
A<X> Function<X>() test10() => A.bar1;
2+
A<X> Function<X>(X) test1() => A.foo1;
3+
A<X> Function<X>(X) test11() => A.bar1;
4+
A<X> Function<X>(X) test2() => A.foo2;
5+
A<X> Function<X>(X) test3() => A.new;
6+
A<X> Function<X>(X) test4() => A<int>.new;
7+
A<X> Function<X>(X) test5() => A<int, String>.new;
8+
A<X> Function<X>(X) test6() => A<int>.foo1;
9+
A<X> Function<X>(X) test7() => A<int, String>.foo1;
10+
A<X> Function<X>(X) test8() => A<int>.foo2;
11+
A<X> Function<X>(X) test9() => A<int, String>.foo2;
12+
A<int> Function() test12() => A<int>.bar1;
13+
A<int> Function() test13() => A.bar1;
314

415
class A<X> {
16+
A();
517
A.foo1(X x) {}
618
A.foo2(X x, int y) {}
19+
factory A.bar1() => new A();
720
}
821

922
main() {}

0 commit comments

Comments
 (0)