From 5657acfc76275d5136eacf4c2a61d3f67583fd81 Mon Sep 17 00:00:00 2001 From: Robert Nystrom Date: Tue, 17 Aug 2021 00:30:11 +0000 Subject: [PATCH] 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 Commit-Queue: Bob Nystrom Reviewed-by: Nate Bosch --- DEPS | 2 +- ...ation.dart.textual_outline_modelled.expect | 2 + ...const_tear_off.dart.textual_outline.expect | 1 + ...r_off.dart.textual_outline_modelled.expect | 27 ++++++++++++ ...ation.dart.textual_outline_modelled.expect | 5 +++ ...rrors.dart.textual_outline_modelled.expect | 13 ++++++ ...new_as_unnamed.dart.textual_outline.expect | 8 ++++ ...named.dart.textual_outline_modelled.expect | 43 +++++++++++++++++++ ...f_with_context.dart.textual_outline.expect | 1 + ...ntext.dart.textual_outline_modelled.expect | 17 +++++++- ...ithout_context.dart.textual_outline.expect | 1 + ...ntext.dart.textual_outline_modelled.expect | 14 +++++- ...roffs.dart.textual_outline_modelled.expect | 8 ++++ ...uctor_tear_off.dart.textual_outline.expect | 4 ++ ...r_off.dart.textual_outline_modelled.expect | 21 +++++++++ ..._proper_rename.dart.textual_outline.expect | 2 + ...ename.dart.textual_outline_modelled.expect | 18 ++++++++ .../instantiation.dart.textual_outline.expect | 1 + ...ation.dart.textual_outline_modelled.expect | 17 ++++++-- ...uctor_tear_off.dart.textual_outline.expect | 4 ++ ...r_off.dart.textual_outline_modelled.expect | 2 + ..._proper_rename.dart.textual_outline.expect | 2 + ...ename.dart.textual_outline_modelled.expect | 28 ++++++++++++ ...erred_tear_off.dart.textual_outline.expect | 3 ++ ...r_off.dart.textual_outline_modelled.expect | 24 +++++++++++ .../main.dart.textual_outline.expect | 1 + .../main.dart.textual_outline_modelled.expect | 13 ++++++ ...edef_identical.dart.textual_outline.expect | 1 + ...tical.dart.textual_outline_modelled.expect | 13 ++++++ ...f_with_context.dart.textual_outline.expect | 1 + ...ntext.dart.textual_outline_modelled.expect | 10 ++++- ...ithout_context.dart.textual_outline.expect | 1 + ...ntext.dart.textual_outline_modelled.expect | 10 ++++- ...g_constructors.dart.textual_outline.expect | 2 + ...ctors.dart.textual_outline_modelled.expect | 11 +++++ ...erals.dart.textual_outline_modelled.expect | 3 ++ ...ename_identity.dart.textual_outline.expect | 11 +++++ ...ntity.dart.textual_outline_modelled.expect | 25 +++++++++++ ...pedef_tearoffs.dart.textual_outline.expect | 2 + ...roffs.dart.textual_outline_modelled.expect | 39 +++++++++++++++++ ...ed_constructor.dart.textual_outline.expect | 4 ++ ...uctor.dart.textual_outline_modelled.expect | 20 +++++++++ .../testcases/textual_outline.status | 23 ---------- 43 files changed, 423 insertions(+), 35 deletions(-) create mode 100644 pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/explicit_instantiation_errors.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/identical_instantiated_function_tearoffs.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/simple_instantiated_type_literals.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline_modelled.expect create mode 100644 pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline_modelled.expect diff --git a/DEPS b/DEPS index ee3a8191397..c7ffc18e98f 100644 --- a/DEPS +++ b/DEPS @@ -103,7 +103,7 @@ vars = { # and land the review. # # For more details, see https://github.com/dart-lang/sdk/issues/30164 - "dart_style_rev": "06bfd19593ed84dd288f67e02c6a753e6516288a", + "dart_style_rev": "14d9b6fd58cc4744676c12be3cc5eee2a779db82", "dartdoc_rev" : "5f39ec674d81f5c199151d823fa4ecd01fc59eb2", "devtools_rev" : "64cffbed6366329ad05e44d48fa2298367643bb6", diff --git a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline_modelled.expect index fa69e2dcc2f..3d25c7aad5f 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline_modelled.expect @@ -1,4 +1,6 @@ T func(T value) => value; int Function(int) f = funcValue.call; +int Function(int) g = funcValue.call; main() {} +test(Function f) {} var funcValue = func; diff --git a/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline.expect index a4b6c13210b..7fa3351a9ad 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline.expect @@ -3,6 +3,7 @@ class A { factory A.fact() => new A(); factory A.redirect() = A; } + typedef B = A; typedef C = A; const a = A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..34b33d794da --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/const_tear_off.dart.textual_outline_modelled.expect @@ -0,0 +1,27 @@ +class A { + A(); + factory A.fact() => new A(); + factory A.redirect() = A; +} + +const a = A.new; +const b = A.new; +const c = A.fact; +const d = A.fact; +const e = A.redirect; +const f = A.redirect; +const g = B.new; +const h = B.new; +const i = B.fact; +const j = B.fact; +const k = B.redirect; +const l = B.redirect; +const m = C.new; +const n = C.new; +const o = C.fact; +const p = C.fact; +const q = C.redirect; +const r = C.redirect; +main() {} +typedef B = A; +typedef C = A; diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..1225dc9b077 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline_modelled.expect @@ -0,0 +1,5 @@ +main() {} +test1(dynamic x) => x.foo; +test2(Never x) => x.foo; +test3(dynamic x) => x.toString; +test4(Never x) => x.toString; diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_instantiation_errors.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_instantiation_errors.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..0e3fd34cbc9 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_instantiation_errors.dart.textual_outline_modelled.expect @@ -0,0 +1,13 @@ +X boundedMethod(X x) => x; +X id(X x) => x; +main() {} +test() {} +var a = id; +var b = a; +var c = id; +var d = id; +var e = method; +var f = 0; +var g = main; +var h = boundedMethod; +void method() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect index d6ac3476941..1c706824d17 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect @@ -1,35 +1,43 @@ class A { A.new(); } + class B { B(); } + class C { C(); C.new(); } + class D { D.new(); D(); } + class E1 { E1._(); E1(); factory E1.new() => E1._(); } + class E2 { E2._(); factory E2.new() => E2._(); E2(); } + class E3 { E3._(); E3(); factory E3.new() = E3._; } + class E4 { E4._(); factory E4.new() = E4._; E4(); } + main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..fd6763c5c78 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline_modelled.expect @@ -0,0 +1,43 @@ +class A { + A.new(); +} + +class B { + B(); +} + +class C { + C(); + C.new(); +} + +class D { + D(); + D.new(); +} + +class E1 { + E1(); + E1._(); + factory E1.new() => E1._(); +} + +class E2 { + E2(); + E2._(); + factory E2.new() => E2._(); +} + +class E3 { + E3(); + E3._(); + factory E3.new() = E3._; +} + +class E4 { + E4(); + E4._(); + factory E4.new() = E4._; +} + +main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect index 89a5de5d846..556ac620b25 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect @@ -4,6 +4,7 @@ class A { A(); factory A.bar1() => new A(); } + A Function(X) test1() => A.foo1; A Function(X) test2() => A.foo2; A Function(X) test3() => A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline_modelled.expect index 5110c82b78d..fce295c6ea7 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline_modelled.expect @@ -1,9 +1,22 @@ -A Function(X) bar1() => A.foo1; -A Function(X) bar2() => A.foo2; +A Function() test10() => A.bar1; +A Function(X) test1() => A.foo1; +A Function(X) test11() => A.bar1; +A Function(X) test2() => A.foo2; +A Function(X) test3() => A.new; +A Function(X) test4() => A.new; +A Function(X) test5() => A.new; +A Function(X) test6() => A.foo1; +A Function(X) test7() => A.foo1; +A Function(X) test8() => A.foo2; +A Function(X) test9() => A.foo2; +A Function() test12() => A.bar1; +A Function() test13() => A.bar1; class A { + A(); A.foo1(X x) {} A.foo2(X x, int y) {} + factory A.bar1() => new A(); } main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect index a5d04bfe835..16c7e62b995 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect @@ -3,6 +3,7 @@ class A { A() {} factory A.bar() => new A(); } + testFoo() => A.foo; testFooArgs() => A.foo; testNew() => A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline_modelled.expect index bd45e3c5e1f..bb92a38a526 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline_modelled.expect @@ -1,7 +1,17 @@ -bar() => A.foo; - class A { + A() {} A.foo() {} + factory A.bar() => new A(); } main() {} +method() {} +testBar() => A.bar; +testBarArgs() => A.bar; +testBarExtraArgs() => A.bar; +testFoo() => A.foo; +testFooArgs() => A.foo; +testFooExtraArgs() => A.foo; +testNew() => A.new; +testNewArgs() => A.new; +testNewExtraArgs() => A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/identical_instantiated_function_tearoffs.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/identical_instantiated_function_tearoffs.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..d650780bb04 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/identical_instantiated_function_tearoffs.dart.textual_outline_modelled.expect @@ -0,0 +1,8 @@ +T Function(T) create() => id; +T id(T t) => t; +const explicitConstInstantiation = id; +const int Function(int) implicitConstInstantiation = id; +expect(expected, actual) {} +int Function(int) implicitInstantiation = id; +main() {} +var explicitInstantiation = id; diff --git a/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline.expect index 94115d1686c..f48ab148007 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline.expect @@ -1,16 +1,20 @@ final bool inSoundMode = [] is! List; main() {} + class Class1 { int field; Class1(this.field); } + abstract class Interface2 { int get field; } + class Class2 implements Interface2 { final field; Class2(this.field); } + var Class1_new = Class1.new; var Class2_new = Class2.new; testInferred() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..99d1f464644 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/inferred_constructor_tear_off.dart.textual_outline_modelled.expect @@ -0,0 +1,21 @@ +abstract class Interface2 { + int get field; +} + +class Class1 { + Class1(this.field); + int field; +} + +class Class2 implements Interface2 { + Class2(this.field); + final field; +} + +expect(expected, actual) {} +final bool inSoundMode = [] is! List; +main() {} +testInferred() {} +throws(Function() f, {bool inSoundModeOnly: false}) {} +var Class1_new = Class1.new; +var Class2_new = Class2.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline.expect index 71dbef8f6f8..b8acf78671a 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline.expect @@ -1,5 +1,7 @@ final bool inSoundMode = [] is! List; + class A {} + typedef F = A; typedef G = A; typedef H = A; diff --git a/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..5bf6db55b20 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/inferred_non_proper_rename.dart.textual_outline_modelled.expect @@ -0,0 +1,18 @@ +class A {} + +const A Function() f1c = F.new; +const A Function() g1c = G.new; +const A Function() h1c = H.new; +const f1a = A.new; +const f1b = F.new; +const g1a = A.new; +const g1b = G.new; +const h1a = A.new; +const h1b = H.new; +expect(expected, actual) {} +final bool inSoundMode = [] is! List; +main() {} +test() {} +typedef F = A; +typedef G = A; +typedef H = A; diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect index 53e6fd012cb..e1a475c54b1 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect @@ -3,6 +3,7 @@ class A { A(X x) {} factory A.bar(X x) => new A(x); } + A Function(num) test1() => A.foo; A Function(int) test2() => A.foo; A Function(num) test3() => A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline_modelled.expect index 88026bf8def..2ea13b4b965 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline_modelled.expect @@ -1,9 +1,20 @@ -A Function(String) bar3() => A.foo; -A Function(int) bar2() => A.foo; -A Function(num) bar1() => A.foo; +A Function(String) test11() => A.bar; +A Function(String) test5() => A.foo; +A Function(String) test6() => A.new; +A Function(num) test12() => A.bar; +A Function(num) test7() => A.foo; +A Function(num) test8() => A.new; +A Function(int) test10() => A.bar; +A Function(int) test2() => A.foo; +A Function(int) test4() => A.new; +A Function(num) test1() => A.foo; +A Function(num) test3() => A.new; +A Function(num) test9() => A.bar; class A { + A(X x) {} A.foo(X x) {} + factory A.bar(X x) => new A(x); } main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline.expect index 94115d1686c..f48ab148007 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline.expect @@ -1,16 +1,20 @@ final bool inSoundMode = [] is! List; main() {} + class Class1 { int field; Class1(this.field); } + abstract class Interface2 { int get field; } + class Class2 implements Interface2 { final field; Class2(this.field); } + var Class1_new = Class1.new; var Class2_new = Class2.new; testInferred() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline_modelled.expect index 8944ae7c0d7..99d1f464644 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_constructor_tear_off.dart.textual_outline_modelled.expect @@ -17,3 +17,5 @@ final bool inSoundMode = [] is! List; main() {} testInferred() {} throws(Function() f, {bool inSoundModeOnly: false}) {} +var Class1_new = Class1.new; +var Class2_new = Class2.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline.expect index 8731bf4694a..7efc9f8508e 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline.expect @@ -1,9 +1,11 @@ final bool inSoundMode = [] is! List; + class A { A(); factory A.fact() => new A(); factory A.redirect() = A; } + typedef F = A; typedef G = A; typedef H = A; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..ebc6c89b774 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_non_proper_rename.dart.textual_outline_modelled.expect @@ -0,0 +1,28 @@ +class A { + A(); + factory A.fact() => new A(); + factory A.redirect() = A; +} + +const A Function() f1c = F.new; +const A Function() f1f = F.fact; +const A Function() f1i = F.redirect; +const A Function() g1c = G.new; +const A Function() h1c = H.new; +const f1a = A.new; +const f1b = F.new; +const f1d = A.fact; +const f1e = F.fact; +const f1g = A.redirect; +const f1h = F.redirect; +const g1a = A.new; +const g1b = G.new; +const h1a = A.new; +const h1b = H.new; +expect(expected, actual) {} +final bool inSoundMode = [] is! List; +main() {} +test() {} +typedef F = A; +typedef G = A; +typedef H = A; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline.expect index 12bef00a78e..c125e6f7f16 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline.expect @@ -2,17 +2,20 @@ var A_new = A.new; var B_new = B.new; var F_new = F.new; var G_new = G.new; + class A { int field1 = 0; A(this.field1); A.named(this.field1); } + class B implements A { var field1; T field2; B(this.field1, this.field2); B.named(this.field1, this.field2); } + typedef F = A; typedef G = B; var A_named = A.named; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..b23c6e8b182 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/inferred_tear_off.dart.textual_outline_modelled.expect @@ -0,0 +1,24 @@ +class A { + A(this.field1); + A.named(this.field1); + int field1 = 0; +} + +class B implements A { + B(this.field1, this.field2); + B.named(this.field1, this.field2); + T field2; + var field1; +} + +main() {} +typedef F = A; +typedef G = B; +var A_named = A.named; +var A_new = A.new; +var B_named = B.named; +var B_new = B.new; +var F_named = F.named; +var F_new = F.new; +var G_named = G.named; +var G_new = G.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline.expect index 4d2dfc1a728..a676ddd1f18 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline.expect @@ -1,4 +1,5 @@ import 'main_lib.dart'; + typedef H = A; dynamic H_new = H.new; dynamic H_named = H.named; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..ea3a97bf0e4 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_from_dill/main.dart.textual_outline_modelled.expect @@ -0,0 +1,13 @@ +import 'main_lib.dart'; + +dynamic F_fact = F.fact; +dynamic F_named = F.named; +dynamic F_new = F.new; +dynamic F_redirect = F.redirect; +dynamic H_fact = H.fact; +dynamic H_named = H.named; +dynamic H_new = H.new; +dynamic H_redirect = H.redirect; +expect(expected, actual) {} +main() {} +typedef H = A; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline.expect index 8ca6604d4cc..10356c51f2c 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline.expect @@ -1,4 +1,5 @@ import 'typedef_identical_lib.dart'; + typedef H = A; var H_new = H.new; var H_named = H.named; diff --git a/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..a3e22a5a0c1 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/lowering/typedef_identical.dart.textual_outline_modelled.expect @@ -0,0 +1,13 @@ +import 'typedef_identical_lib.dart'; + +expect(expected, actual) {} +main() {} +typedef H = A; +var F_fact = F.fact; +var F_named = F.named; +var F_new = F.new; +var F_redirect = F.redirect; +var H_fact = H.fact; +var H_named = H.named; +var H_new = H.new; +var H_redirect = H.redirect; diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect index 8667cb71a8d..69dd5511593 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect @@ -4,6 +4,7 @@ class A { A() {} factory A.bar1() => new A(); } + A Function() test1() => A.foo1; A Function() test2() => A.foo2; A Function() test3() => A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline_modelled.expect index c7ab6c9e60d..16a7e1cfdf2 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline_modelled.expect @@ -1,9 +1,15 @@ -A Function() bar1() => A.foo1; -A Function() bar2() => A.foo2; +A Function() test1() => A.foo1; +A Function() test2() => A.foo2; +A Function() test3() => A.new; +A Function() test5() => A.bar1; +A Function(int) test4() => A.new; +A Function(int) test6() => A.bar1; class A { + A() {} A.foo1() {} A.foo2(int x) {} + factory A.bar1() => new A(); } main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect index 7cdb5cdb9ff..17d1d9890f9 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect @@ -3,6 +3,7 @@ class A { A() {} factory A.bar() => new A(); } + testFoo() => A.foo; testNew() => A.new; testBar() => A.bar; diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline_modelled.expect index 28ca8784b0e..b4855435810 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline_modelled.expect @@ -1,7 +1,13 @@ -bar() => A.foo; - class A { + A() {} A.foo() {} + factory A.bar() => new A(); } main() {} +testBar() => A.bar; +testBarExtraArgs() => A.bar; +testFoo() => A.foo; +testFooExtraArgs() => A.foo; +testNew() => A.new; +testNewExtraArgs() => A.new; diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline.expect index 1e775a78a53..bae4d9cdf56 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline.expect @@ -4,6 +4,8 @@ class A { factory A.redirectingFactoryChild() = B.new; factory A.redirectingTwice() = A.redirectingFactory; } + class B extends A {} + test() {} main() => test(); diff --git a/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..de667599289 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/redirecting_constructors.dart.textual_outline_modelled.expect @@ -0,0 +1,11 @@ +class A { + A.new(); + factory A.redirectingFactory() = A.new; + factory A.redirectingFactoryChild() = B.new; + factory A.redirectingTwice() = A.redirectingFactory; +} + +class B extends A {} + +main() => test(); +test() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/simple_instantiated_type_literals.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/simple_instantiated_type_literals.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..caada6b5863 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/simple_instantiated_type_literals.dart.textual_outline_modelled.expect @@ -0,0 +1,3 @@ +bar() {} +foo() => List; +main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline.expect index 77787a1363f..3023dc3c5ec 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline.expect @@ -1,16 +1,27 @@ class A1 {} + typedef B1 = A1; + class A2 {} + typedef B2 = A2; + class A3, S extends Never?> {} + typedef B3, S extends Null> = A3; + class A4 {} + typedef B4 = A4; + class A5, S extends Never?> {} + typedef B5, S extends Null> = A5; + class StaticIdentityTest { const StaticIdentityTest(a, b) : assert(identical(a, b)); } + test1() => const StaticIdentityTest(A1.new, B1.new); test2() => const StaticIdentityTest(A2.new, B2.new); test3() => const StaticIdentityTest(A3.new, B3.new); diff --git a/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..3167ee05a6e --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/simple_proper_rename_identity.dart.textual_outline_modelled.expect @@ -0,0 +1,25 @@ +class A1 {} + +class A2 {} + +class A3, S extends Never?> {} + +class A4 {} + +class A5, S extends Never?> {} + +class StaticIdentityTest { + const StaticIdentityTest(a, b) : assert(identical(a, b)); +} + +main() {} +test1() => const StaticIdentityTest(A1.new, B1.new); +test2() => const StaticIdentityTest(A2.new, B2.new); +test3() => const StaticIdentityTest(A3.new, B3.new); +test4() => const StaticIdentityTest(A4.new, B4.new); +test5() => const StaticIdentityTest(A5.new, B5.new); +typedef B1 = A1; +typedef B2 = A2; +typedef B3, S extends Null> = A3; +typedef B4 = A4; +typedef B5, S extends Null> = A5; diff --git a/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline.expect index c3a7ab9460f..b8e1aba5a94 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline.expect @@ -1,9 +1,11 @@ class A {} + class B { B(); B.foo(); factory B.bar() => new B(); } + typedef DA1 = A; typedef DA2 = A; typedef DB1 = B; diff --git a/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..43ab7d60289 --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/typedef_tearoffs.dart.textual_outline_modelled.expect @@ -0,0 +1,39 @@ +A Function() test2() => DA1.new; +A Function() test4() => DA2.new; +A Function() test5() => DA2.new; +A Function() test6() => DA2.new; +B Function() test10() => DB1.foo; +B Function() test11() => DB1.bar; +B Function() test24() => DB2.new; +B Function() test8() => DB1.new; +B Function() test23() => DB3.new; +B Function() test17() => DB2.new; +B Function() test22() => DB3.new; +B Function() test16() => DB2.new; +B Function() test12() => DB2.new; +B Function() test13() => DB2.foo; +B Function() test14() => DB2.bar; +B Function() test15() => DB2.new; +B Function() test18() => DB3.new; +B Function() test19() => DB3.foo; +B Function() test20() => DB3.bar; +B Function() test21() => DB3.new; +B Function() test9() => DB1.new; +DA1 Function() test1() => DA1.new; +DA2 Function() test3() => DA2.new; +DB1 Function() test7() => DB1.new; + +class A {} + +class B { + B(); + B.foo(); + factory B.bar() => new B(); +} + +main() {} +typedef DA1 = A; +typedef DA2 = A; +typedef DB1 = B; +typedef DB2 = B; +typedef DB3 = B; diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect index 3e34a968e50..f161d579004 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline.expect @@ -4,13 +4,17 @@ class A { factory A.redirectingFactoryChild() = B.new; A.redirecting() : this.new(); } + class B extends A {} + class C { final int x; const C.new(this.x); } + class D extends C { D(int x) : super.new(x * 2); } + test() {} main() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline_modelled.expect new file mode 100644 index 00000000000..00d195ca26a --- /dev/null +++ b/pkg/front_end/testcases/constructor_tearoffs/unnamed_constructor.dart.textual_outline_modelled.expect @@ -0,0 +1,20 @@ +class A { + A.new(); + A.redirecting() : this.new(); + factory A.redirectingFactory() = A.new; + factory A.redirectingFactoryChild() = B.new; +} + +class B extends A {} + +class C { + const C.new(this.x); + final int x; +} + +class D extends C { + D(int x) : super.new(x * 2); +} + +main() {} +test() {} diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status index ed0e7e4c7a7..27225628f3b 100644 --- a/pkg/front_end/testcases/textual_outline.status +++ b/pkg/front_end/testcases/textual_outline.status @@ -23,29 +23,6 @@ regress/utf_16_le_content.crash: EmptyOutput const_functions/const_functions_const_ctor: FormatterCrash const_functions/const_functions_const_ctor_error: FormatterCrash const_functions/const_functions_const_factory: FormatterCrash -constructor_tearoffs/call_instantiation: FormatterCrash -constructor_tearoffs/const_tear_off: FormatterCrash -constructor_tearoffs/dynamic_explicit_instantiation: FormatterCrash -constructor_tearoffs/explicit_instantiation_errors: FormatterCrash -constructor_tearoffs/explicit_new_as_unnamed: FormatterCrash -constructor_tearoffs/generic_tearoff_with_context: FormatterCrash -constructor_tearoffs/generic_tearoff_without_context: FormatterCrash -constructor_tearoffs/identical_instantiated_function_tearoffs: FormatterCrash -constructor_tearoffs/inferred_constructor_tear_off: FormatterCrash -constructor_tearoffs/inferred_non_proper_rename: FormatterCrash -constructor_tearoffs/instantiation: FormatterCrash -constructor_tearoffs/lowering/inferred_constructor_tear_off: FormatterCrash -constructor_tearoffs/lowering/inferred_non_proper_rename: FormatterCrash -constructor_tearoffs/lowering/inferred_tear_off: FormatterCrash -constructor_tearoffs/lowering/typedef_from_dill/main: FormatterCrash -constructor_tearoffs/lowering/typedef_identical: FormatterCrash -constructor_tearoffs/nongeneric_tearoff_with_context: FormatterCrash -constructor_tearoffs/nongeneric_tearoff_without_context: FormatterCrash -constructor_tearoffs/redirecting_constructors: FormatterCrash -constructor_tearoffs/simple_instantiated_type_literals: FormatterCrash -constructor_tearoffs/simple_proper_rename_identity: FormatterCrash -constructor_tearoffs/typedef_tearoffs: FormatterCrash -constructor_tearoffs/unnamed_constructor: FormatterCrash dart2js/late_fields: FormatterCrash dart2js/late_statics: FormatterCrash extension_types/simple_getter_resolution: FormatterCrash