Roll dart_style into the SDK.

This contains support for all of the 3.0 language features. It also
contains a couple of very minor style changes. Unlike the previous
reverted roll (https://dart-review.googlesource.com/c/sdk/+/285460),
this does *not* contain the style change to support compact switch
statements. This should eliminate most of the style churn.

Change-Id: I95dd73a3a921b4a0cd278a7abb86daf8eea21397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286701
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Robert Nystrom 2023-03-03 18:53:20 +00:00 committed by Commit Queue
parent 3633ff4e71
commit c33ece3515
87 changed files with 708 additions and 125 deletions

View file

@ -158,6 +158,13 @@
#### Web Dev Compiler (DDC)
- Removed deprecated command line flags `-k`, `--kernel`, and `--dart-sdk`.
#### Formatter
* Format `sync*` and `async*` functions with `=>` bodies.
* Don't split after `<` in collection literals.
* Better indentation of multiline function types inside type argument lists.
* Fix bug where parameter metadata wouldn't always split when it should.
#### Linter
Updates the Linter to `1.34.0-dev`, which includes changes that

2
DEPS
View file

@ -134,7 +134,7 @@ vars = {
# and land the review.
#
# For more details, see https://github.com/dart-lang/sdk/issues/30164.
"dart_style_rev": "d0c6b1da52c9f80679a7aaa05e5935ef5c6bb52f", # manually rev'd
"dart_style_rev": "a740aabf43a8b668a8abf8de0530a9f25bb1f5e6", # manually rev'd
"dartdoc_rev": "e4cdbd6f349ecbc420d33cca69a02fb287a7edf5",
"ffi_rev": "32f5eefea59d4461e8ab40e83f157e49d5abe0da",
"file_rev": "72a67c33f90bfb7e10057e286e06d2fe3baa4d98",

View file

@ -1,7 +1,8 @@
final
mixin M1 {}
sealed
mixin M2 {}
final mixin M1 {}
sealed mixin M2 {}
base class S {}
final class C extends S with M1, M2 {}
final class D = S with M1, M2;

View file

@ -0,0 +1,11 @@
---- unknown chunk starts ----
final
---- unknown chunk ends ----
mixin M1 {}
---- unknown chunk starts ----
sealed
---- unknown chunk ends ----
base class S {}
final class C extends S with M1, M2 {}
final class D = S with M1, M2;
mixin M2 {}

View file

@ -1,5 +1,6 @@
base class A {}
abstract base class B {}
base
mixin M {}
base mixin M {}
base class C = Object with M;

View file

@ -0,0 +1,7 @@
abstract base class B {}
base class A {}
---- unknown chunk starts ----
base
---- unknown chunk ends ----
base class C = Object with M;
mixin M {}

View file

@ -1,18 +1,31 @@
base class BaseClass {}
base
mixin BaseMixin {}
base mixin BaseMixin {}
final class FinalClass extends BaseClass {}
sealed class SubtypeOfBase extends BaseClass {}
class RegularClass {}
base
mixin BaseMixin2 {}
base mixin BaseMixin2 {}
class Extends extends BaseClass {}
class Implements implements BaseClass {}
mixin MixinImplements implements BaseMixin {}
class With with BaseMixin {}
class With2 with BaseMixin, BaseMixin2 {}
mixin On on BaseClass {}
class ExtendsExtends extends Extends {}
class Multiple extends FinalClass implements BaseMixin {}
class Multiple2 extends RegularClass implements BaseClass {}
class IndirectSubtype extends SubtypeOfBase {}

View file

@ -1,10 +1,11 @@
import 'main_lib.dart';
base class ImplementsBaseClass implements A {}
base class ImplementsBaseMixin implements M {}
enum EnumImplementsBaseMixin implements M { x }
base
mixin MixinOnA on A {}
base
mixin MixinOnM on M {}
base
mixin MixinOnAM on A, M {}
base mixin MixinOnA on A {}
base mixin MixinOnM on M {}
base mixin MixinOnAM on A, M {}

View file

@ -1,9 +1,16 @@
import 'main_lib.dart';
base class ImplementsBaseClassTypedef implements ATypeDef {}
base class ImplementsBaseClassTypedef2 implements ATypeDef2 {}
base class ImplementsBaseMixinTypeDef implements MTypeDef {}
base class ImplementsBaseMixinTypeDef2 implements MTypeDef2 {}
typedef AOutsideTypedef = A;
typedef MOutsideTypedef = M;
base class ImplementsBaseClassTypedefOutside implements AOutsideTypedef {}
base class ImplementsBaseMixinTypeDefOutside implements MOutsideTypedef {}

View file

@ -1,5 +1,6 @@
final class A {}
abstract final class B {}
final
mixin M {}
final mixin M {}
final class C = Object with M;

View file

@ -0,0 +1,7 @@
abstract final class B {}
final class A {}
---- unknown chunk starts ----
final
---- unknown chunk ends ----
final class C = Object with M;
mixin M {}

View file

@ -1,18 +1,31 @@
final class FinalClass {}
final
mixin FinalMixin {}
final mixin FinalMixin {}
base class BaseClass extends FinalClass {}
sealed class SubtypeOfFinal extends FinalClass {}
class RegularClass {}
final
mixin FinalMixin2 {}
final mixin FinalMixin2 {}
class Extends extends FinalClass {}
class Implements implements FinalClass {}
mixin MixinImplements implements FinalMixin {}
class With with FinalMixin {}
class With2 with FinalMixin, FinalMixin2 {}
mixin On on FinalClass {}
class ExtendsExtends extends Extends {}
class Multiple extends BaseClass implements FinalMixin {}
class Multiple2 extends RegularClass implements FinalClass {}
class IndirectSubtype extends SubtypeOfFinal {}

View file

@ -1,13 +1,17 @@
import 'main_lib.dart';
final class ExtendsFinalClass extends A {}
final class ImplementsFinalClass implements A {}
final class ImplementsFinalMixin implements M {}
final class MixInFinalMixin with M {}
enum EnumImplementsFinalMixin implements M { x }
enum EnumMixInFinalMixin with M { x }
final
mixin MixinOnA on A {}
final
mixin MixinOnM on M {}
final
mixin MixinOnAM on A, M {}
final mixin MixinOnA on A {}
final mixin MixinOnM on M {}
final mixin MixinOnAM on A, M {}

View file

@ -1,24 +1,46 @@
import 'main_lib.dart';
final class ExtendsFinalClassTypedef extends ATypeDef {}
final class ExtendsFinalClassTypedef2 extends ATypeDef2 {}
final class ImplementsFinalClassTypedef implements ATypeDef {}
final class ImplementsFinalClassTypedef2 implements ATypeDef2 {}
enum EnumImplementsFinalClassTypedef implements ATypeDef { x }
enum EnumImplementsFinalClassTypedef2 implements ATypeDef2 { x }
final class ImplementsFinalMixinTypeDef implements MTypeDef {}
final class ImplementsFinalMixinTypeDef2 implements MTypeDef2 {}
enum EnumImplementsFinalMixinTypeDef implements MTypeDef { x }
enum EnumImplementsFinalMixinTypeDef2 implements MTypeDef2 { x }
final class MixInFinalMixinTypeDef with MTypeDef {}
final class MixInFinalMixinTypeDef2 with MTypeDef2 {}
enum EnumMixInFinalMixinTypeDef with MTypeDef { x }
enum EnumMixInFinalMixinTypeDef2 with MTypeDef2 { x }
typedef AOutsideTypedef = A;
typedef MOutsideTypedef = M;
final class ExtendsFinalClassTypedefOutside extends AOutsideTypedef {}
final class ImplementsFinalClassTypedefOutside implements AOutsideTypedef {}
enum EnumImplementsFinalClassTypedefOutside implements AOutsideTypedef { x }
final class ImplementsFinalMixinTypeDefOutside implements MOutsideTypedef {}
enum EnumImplementsFinalMixinTypeDefOutside implements MOutsideTypedef { x }
final class MixInFinalMixinTypeDefOutside with MOutsideTypedef {}
enum EnumMixInFinalMixinTypeDefOutside with MOutsideTypedef { x }

View file

@ -1,5 +1,6 @@
interface class A {}
abstract interface class B {}
interface
mixin M {}
interface mixin M {}
interface class C = Object with M;

View file

@ -0,0 +1,7 @@
abstract interface class B {}
interface class A {}
---- unknown chunk starts ----
interface
---- unknown chunk ends ----
interface class C = Object with M;
mixin M {}

View file

@ -1,9 +1,16 @@
mixin class A {}
abstract mixin class B {}
mixin M {}
mixin class C = Object with M;
class AWith with A {}
class BWith with B {}
class CWith with C {}
class MultipleWithMixin with A, M {}
class MultipleWithAnotherClass with A, B {}

View file

@ -0,0 +1,17 @@
abstract mixin class B {}
class AWith with A {}
class BWith with B {}
class CWith with C {}
class MultipleWithAnotherClass with A, B {}
class MultipleWithMixin with A, M {}
mixin M {}
mixin class A {}
mixin class C = Object with M;

View file

@ -2,35 +2,43 @@ mixin class ErrorMixinClass {
final int foo;
ErrorMixinClass(this.foo);
}
mixin class ErrorMixinClassNamed {
final int foo;
ErrorMixinClassNamed.named(this.foo);
}
mixin class ErrorMixinClassRedirect {
int foo = 0;
ErrorMixinClassRedirect.named(int f) {}
ErrorMixinClassRedirect.x(int f) : this.named(f);
ErrorMixinClassRedirect() {}
}
mixin class ErrorMixinClassExternal {
external ErrorMixinClassExternal();
}
mixin class ErrorMixinClassSuper {
ErrorMixinClassSuper(): super();
ErrorMixinClassSuper() : super();
}
mixin class ErrorMixinClassBody {
ErrorMixinClassBody() {}
}
mixin class MixinClassConstructor {
int foo = 0;
MixinClassConstructor();
MixinClassConstructor.named();
}
mixin class ConstMixinClassConstructor {
final int foo = 0;
const ConstMixinClassConstructor();
const ConstMixinClassConstructor.named();
}
mixin class MixinClassFactory {
int foo = 0;
MixinClassFactory();

View file

@ -0,0 +1,49 @@
mixin class ConstMixinClassConstructor {
const ConstMixinClassConstructor();
const ConstMixinClassConstructor.named();
final int foo = 0;
}
mixin class ErrorMixinClass {
ErrorMixinClass(this.foo);
final int foo;
}
mixin class ErrorMixinClassBody {
ErrorMixinClassBody() {}
}
mixin class ErrorMixinClassExternal {
external ErrorMixinClassExternal();
}
mixin class ErrorMixinClassNamed {
ErrorMixinClassNamed.named(this.foo);
final int foo;
}
mixin class ErrorMixinClassRedirect {
ErrorMixinClassRedirect() {}
ErrorMixinClassRedirect.named(int f) {}
ErrorMixinClassRedirect.x(int f) : this.named(f);
int foo = 0;
}
mixin class ErrorMixinClassSuper {
ErrorMixinClassSuper() : super();
}
mixin class MixinClassConstructor {
MixinClassConstructor();
MixinClassConstructor.named();
int foo = 0;
}
mixin class MixinClassFactory {
MixinClassFactory();
MixinClassFactory.named();
factory MixinClassFactory.x() = MixinClassFactory.named;
factory MixinClassFactory.y() = MixinClassFactory;
factory MixinClassFactory.z() {}
int foo = 0;
}

View file

@ -1,6 +1,10 @@
mixin class NotObject {}
mixin class AlsoNotObject {}
mixin class A extends NotObject {}
mixin class B extends Object with NotObject {}
mixin class C = Object with NotObject;
mixin class D = Object with AlsoNotObject, NotObject;

View file

@ -0,0 +1,10 @@
mixin class A extends NotObject {}
mixin class AlsoNotObject {}
mixin class B extends Object with NotObject {}
mixin class C = Object with NotObject;
mixin class D = Object with AlsoNotObject, NotObject;
mixin class NotObject {}

View file

@ -1,6 +1,7 @@
// @dart = 2.19
final class A {}
abstract final class B {}
final
mixin M {}
final mixin M {}
final class C = Object with M;

View file

@ -0,0 +1,8 @@
// @dart = 2.19
abstract final class B {}
final class A {}
---- unknown chunk starts ----
final
---- unknown chunk ends ----
final class C = Object with M;
mixin M {}

View file

@ -1,4 +1,6 @@
mixin class A {}
abstract mixin class B {}
mixin M {}
mixin class C = Object with M;

View file

@ -0,0 +1,7 @@
abstract mixin class B {}
mixin M {}
mixin class A {}
mixin class C = Object with M;

View file

@ -0,0 +1,6 @@
(int, String) method1(int a, String b) => (a, b);
({int a, String b}) method4(int a, String b) => (a: a, b: b);
String method3([(int, String) record = const (0, '')]) => record.$2;
String method6([({int a, String b}) record = const (a: 0, b: '')]) => record.b;
int method2([(int, String) record = const (0, '')]) => record.$1;
int method5([({int a, String b}) record = const (a: 0, b: '')]) => record.a;

View file

@ -0,0 +1,4 @@
main() {}
test1(dynamic x) => [1, if (x case int y) 2 else y, 3];
test2(dynamic x) => <int>{1, if (x case int y) 2 else y, 3};
test3(dynamic x) => <int, int>{1: 1, if (x case int y) 2: 2 else 2: y, 3: 3};

View file

@ -1,19 +1,21 @@
import 'dart:math' as math;
sealed class Shape {
double calculateArea();
}
class Square implements Shape {
final double length;
Square(this.length);
double calculateArea() => length * length;
}
class Circle implements Shape {
final double radius;
Circle(this.radius);
double calculateArea() => math.pi * radius * radius;
}
double calculateArea(Shape shape) =>
switch (shape) {}
;
double calculateArea(Shape shape) => switch (shape) { };
main() {}
expect(expected, actual) {}

View file

@ -0,0 +1,21 @@
import 'dart:math' as math;
class Circle implements Shape {
Circle(this.radius);
double calculateArea() => math.pi * radius * radius;
final double radius;
}
class Square implements Shape {
Square(this.length);
double calculateArea() => length * length;
final double length;
}
double calculateArea(Shape shape) =>
sealed class Shape {
double calculateArea();
}
switch (shape) {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----
expect(expected, actual) {}
main() {}

View file

@ -1,11 +1,13 @@
import 'pattern_types_lib1.dart';
import 'pattern_types_lib2.dart';
typedef Dynamic = dynamic;
typedef Function1 = void Function();
typedef Function1_ = Function1?;
typedef Record1 = (int, {String named});
typedef Record1_ = Record1?;
typedef Class_ = Class?;
class Class {
var field;
void method() {}
@ -13,10 +15,12 @@ class Class {
int operator >(int i) => 0;
operator ==(other) => true;
}
class Class2 {
bool operator <(Class2 i) => true;
operator ==(covariant Class2 other) => true;
}
extension on Class {
int get extensionGetter => 42;
void extensionMethod() {}
@ -24,14 +28,27 @@ extension on Class {
int operator >=(int i) => 0;
int get ambiguousField => 42;
}
extension on Class {
String get ambiguousField => '42';
}
extension on String {
bool operator <=(other) => true;
}
extension on String {
bool operator <=(other) => true;
}
objectPattern(o) {}
relationalPattern(dynamic dyn, Never never, Class cls, Class? cls_, Invalid invalid, String string, Class2 cls2, Class2? cls2_, ) {}
relationalPattern(
dynamic dyn,
Never never,
Class cls,
Class? cls_,
Invalid invalid,
String string,
Class2 cls2,
Class2? cls2_,
) {}

View file

@ -0,0 +1,53 @@
import 'pattern_types_lib1.dart';
import 'pattern_types_lib2.dart';
class Class {
bool operator <(int i) => true;
int operator >(int i) => 0;
operator ==(other) => true;
var field;
void method() {}
}
class Class2 {
bool operator <(Class2 i) => true;
operator ==(covariant Class2 other) => true;
}
extension on Class {
String get ambiguousField => '42';
}
extension on Class {
bool operator <=(int i) => true;
int get ambiguousField => 42;
int get extensionGetter => 42;
int operator >=(int i) => 0;
void extensionMethod() {}
}
extension on String {
bool operator <=(other) => true;
}
extension on String {
bool operator <=(other) => true;
}
objectPattern(o) {}
relationalPattern(
dynamic dyn,
Never never,
Class cls,
Class? cls_,
Invalid invalid,
String string,
Class2 cls2,
Class2? cls2_,
) {}
typedef Class_ = Class?;
typedef Dynamic = dynamic;
typedef Function1 = void Function();
typedef Function1_ = Function1?;
typedef Record1 = (int, {String named});
typedef Record1_ = Record1?;

View file

@ -0,0 +1,3 @@
(double lat, double long) getLocation(String name) {}
expect(expected, actual) {}
void main(List<String> arguments) {}

View file

@ -0,0 +1,5 @@
test1(Record x) {}
test2((int, int) x) {}
test3((int, {int a}) x) {}
test4(({int a, int b}) x) {}
test5((int, double, {String foo, dynamic bar}) x) {}

View file

@ -0,0 +1,6 @@
expectEquals(x, y) {}
listToString(List<dynamic> list) {}
main() {}
test1(dynamic x) => [1, if (x case [int y, ...]) y, 1];
test2(dynamic x) => [2, if (x case String y) y else null, 2];
test3(dynamic x) => [3, if (x case bool b when b) b, 3];

View file

@ -0,0 +1,6 @@
expectEquals(x, y) {}
main() {}
mapToString(Map<dynamic, dynamic> map) {}
test1(dynamic x) => {1: 1, if (x case int y) 2: y, 3: 3};
test2(dynamic x) => {1: 1, if (x case String y) 2: y else 2: null, 3: 3};
test3(dynamic x) => {1: 1, if (x case bool b when b) 2: b, 3: 3};

View file

@ -1,3 +1 @@
f(x) =>
switch(x) {}
;
f(x) => switch (x) { };

View file

@ -0,0 +1,5 @@
f(x) =>
switch(x) {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----

View file

@ -1,3 +1 @@
f(x) =>
switch(x) {}
;
f(x) => switch (x) { };

View file

@ -0,0 +1,5 @@
f(x) =>
switch(x) {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----

View file

@ -1,3 +1 @@
f(x) =>
switch(x) {}
;
f(x) => switch (x) { };

View file

@ -0,0 +1,5 @@
f(x) =>
switch(x) {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----

View file

@ -1,3 +1 @@
f(x) =>
switch(x) {}
;
f(x) => switch (x) { };

View file

@ -0,0 +1,5 @@
f(x) =>
switch(x) {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----

View file

@ -1,3 +1 @@
f(x) =>
switch(x) {}
;
f(x) => switch (x) { };

View file

@ -0,0 +1,5 @@
f(x) =>
switch(x) {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----

View file

@ -1,15 +1,13 @@
import 'dart:math' as math;
class Circle {
final double radius;
Circle(this.radius);
}
test1(dynamic x) =>
switch (x) {}
;
test1(dynamic x) => switch (x) { };
dynamic Function(dynamic)? captured;
test2(dynamic x) =>
switch (x) {}
;
test2(dynamic x) => switch (x) { };
test3(dynamic x) {}
main() {}
expectEquals(x, y) {}

View file

@ -0,0 +1,19 @@
import 'dart:math' as math;
class Circle {
Circle(this.radius);
final double radius;
}
switch (x) {}
test1(dynamic x) =>
---- unknown chunk starts ----
;
---- unknown chunk ends ----
dynamic Function(dynamic)? captured;
switch (x) {}
test2(dynamic x) =>
---- unknown chunk starts ----
;
---- unknown chunk ends ----
expectEquals(x, y) {}
main() {}
test3(dynamic x) {}

View file

@ -0,0 +1,14 @@
method1a<T extends (int, String)>(T t) => t.$1;
method1b<T extends (int, String)>(T t) => t.$2;
method1c<T extends (int, String)>(T t) => t.$3;
method1d<T extends (int, String)>(T t) => t.a;
method2a<T extends (int, {String a})>(T t) => t.$1;
method2b<T extends (int, {String a})>(T t) => t.a;
method2c<T extends (int, {String a})>(T t) => t.$2;
method2d<T extends (int, {String a})>(T t) => t.b;
method3a<T extends (int, String), S extends T>(S t) => t.$1;
method3b<T extends (int, String), S extends T>(S t) => t.$2;
method3c<T extends (int, String), S extends T>(S t) => t.$3;
method3d<T extends (int, String), S extends T>(S t) => t.a;
void method1<T>(T t) {}
void method2(Object t) {}

View file

@ -1,4 +1,3 @@
void main() {}
Iterable<(Iterable<A>, Iterable<A>)> split<A>(Iterable<A> it) =>
switch (it) {}
;
Iterable<(Iterable<A>, Iterable<A>)> split<A>(Iterable<A> it) =>
switch (it) { };

View file

@ -0,0 +1,6 @@
Iterable<(Iterable<A>, Iterable<A>)> split<A>(Iterable<A> it) =>
switch (it) {}
void main() {}
---- unknown chunk starts ----
;
---- unknown chunk ends ----

View file

@ -1,6 +1,7 @@
class C {
final (num, {String name}) r;
const C(int i, String s): r = (i + 1, name: s + "!");
const C(int i, String s) : r = (i + 1, name: s + "!");
}
main() {}
expect(expected, actual) {}

View file

@ -0,0 +1,7 @@
class C {
const C(int i, String s) : r = (i + 1, name: s + "!");
final (num, {String name}) r;
}
expect(expected, actual) {}
main() {}

View file

@ -0,0 +1,16 @@
const dynamic a = (1, 2);
const dynamic b1 = (a: 1, b: 2);
const dynamic b2 = (b: 2, a: 1);
const dynamic b3 = (b: 2, 1);
const dynamic c1 = (a: a, b: b1);
const dynamic c2 = (b: b2, a: a);
const dynamic c3 = (b: b3, a);
const dynamic d = (c1, (1, 2));
dynamic e = const (1, 2);
dynamic f1 = const (a: 1, b: 2);
dynamic f2 = const (b: 2, a: 1);
dynamic f3 = const (b: 2, 1);
dynamic g1 = const (a: a, b: b1);
dynamic g2 = const (b: b2, a: a);
dynamic g3 = const (b: b3, a);
dynamic h = const (c1, (1, 2));

View file

@ -0,0 +1,8 @@
(int x, String x) foo2() => throw 0;
(int x, int x) foo1() => throw 0;
(int x, int x, int x) foo7() => throw 0;
(int x, {String x}) foo4() => throw 0;
(int x, {int x}) foo3() => throw 0;
({int x, String x}) foo6() => throw 0;
({int x, int x}) foo5() => throw 0;
main() {}

View file

@ -2,4 +2,5 @@ class A {
final (int, int) pair;
const A(int x, int y) : pair = (x, y);
}
void main() {}

View file

@ -0,0 +1,6 @@
class A {
const A(int x, int y) : pair = (x, y);
final (int, int) pair;
}
void main() {}

View file

@ -0,0 +1,3 @@
main() {}
test() {}
typedef Foo = (int, int);

View file

@ -1,11 +1,15 @@
class A {
int get foo => 0;
}
extension on A {
void set foo(int value) {}
}
typedef R = ({int foo});
extension on R {
void set foo(int value) {}
}
test(A a, R r) {}

View file

@ -0,0 +1,14 @@
class A {
int get foo => 0;
}
extension on A {
void set foo(int value) {}
}
extension on R {
void set foo(int value) {}
}
test(A a, R r) {}
typedef R = ({int foo});

View file

@ -1,10 +1,13 @@
void main() {}
class MyClass<T> {
MyClass(this.myField);
final Value<Hello<T>>? Function() myField;
}
class Value<T> {
Value(this.value);
final T value;
}
typedef Hello<T> = (T, {T name});

View file

@ -0,0 +1,12 @@
class MyClass<T> {
MyClass(this.myField);
final Value<Hello<T>>? Function() myField;
}
class Value<T> {
Value(this.value);
final T value;
}
typedef Hello<T> = (T, {T name});
void main() {}

View file

@ -1,4 +1,5 @@
class A {
const A();
}
test() => const <Record>{ const (1, 2, A()), const (1, 2, A()) };
test() => const <Record>{const (1, 2, A()), const (1, 2, A())};

View file

@ -0,0 +1,5 @@
class A {
const A();
}
test() => const <Record>{const (1, 2, A()), const (1, 2, A())};

View file

@ -1,5 +1,6 @@
class A {
const A();
bool operator==(Object other) => false;
bool operator ==(Object other) => false;
}
test() => const <(A,)>{ (A(),) };
test() => const <(A,)>{(A(),)};

View file

@ -0,0 +1,6 @@
class A {
bool operator ==(Object other) => false;
const A();
}
test() => const <(A,)>{(A(),)};

View file

@ -0,0 +1,13 @@
(int, double, num, {String $3}) test12() => throw 0;
(int, {String $1}) test4() => throw 0;
(num, bool, {double $01}) test9() => throw 0;
(num, {double $01}) test7() => throw 0;
(num, {double $0x1}) test8() => throw 0;
(num, {double $2}) test6() => throw 0;
({String $1, bool $01, int $0x1}) test10() => throw 0;
({bool $1}) test5() => throw 0;
main() {}
test1() => (0, $1: 0);
test11() => (10, 11, 12, $3: 13);
test2() => ($1: 0);
test3() => (0, $2: 1);

View file

@ -1,13 +1,18 @@
test((int, String, {double d, void Function() f, Class c})? record, List<(int, String, {double d, void Function() f, Class c})>? list) {}
test((int, String, {double d, void Function() f, Class c})? record,
List<(int, String, {double d, void Function() f, Class c})>? list) {}
extension on int {
void call() {}
}
extension on String {
void call() {}
}
extension on double {
void call() {}
}
class Class {
void call() {}
}

View file

@ -0,0 +1,18 @@
class Class {
void call() {}
}
extension on String {
void call() {}
}
extension on double {
void call() {}
}
extension on int {
void call() {}
}
test((int, String, {double d, void Function() f, Class c})? record,
List<(int, String, {double d, void Function() f, Class c})>? list) {}

View file

@ -1 +1 @@
method((int,{String a})? r) {}
method((int, {String a})? r) {}

View file

@ -0,0 +1 @@
method((int, {String a})? r) {}

View file

@ -1,4 +1,5 @@
method((int,{String a})? r) {}
method((int, {String a})? r) {}
extension on (int, {String a})? {
int get $1 => 0;
String get a => '';

View file

@ -0,0 +1,6 @@
extension on (int, {String a})? {
String get a => '';
int get $1 => 0;
}
method((int, {String a})? r) {}

View file

@ -0,0 +1,4 @@
(int _foo,) foo1() => throw 0;
({int _foo}) foo2() => throw 0;
foo3() => (_foo: 1);
main() {}

View file

@ -0,0 +1,6 @@
(int, String b) topLevelFieldType = throw '';
(int, {String b}) topLevelMethodReturnType() => throw '';
const annotation = 1;
void method() {}
void topLevelMethodParameterType((String, @annotation int) o) {}
void topLevelSetterType(({@annotation int a, String b}) value) {}

View file

@ -0,0 +1,13 @@
(int hashCode,) foo1() => throw 0;
(int noSuchMethod,) foo3() => throw 0;
(int runtimeType,) foo2() => throw 0;
(int toString,) foo4() => throw 0;
({int hashCode}) foo5() => throw 0;
({int noSuchMethod}) foo7() => throw 0;
({int runtimeType}) foo6() => throw 0;
({int toString}) foo8() => throw 0;
foo10() => (runtimeType: 1);
foo11() => (noSuchMethod: 1);
foo12() => (toString: 1);
foo9() => (hashCode: 1);
main() {}

View file

@ -4,12 +4,19 @@ foo3() {}
foo4() {}
foo5((int, String?) r, (int, X) Function<X>() f) {}
foo6((X, Y) Function<X, Y>(X x, Y y) f, int x, String y) {}
foo7((X, (Y, Z)) Function<X, Y, Z>(X x, Y y, Z z) f, int x, String y, bool? z) {}
foo7(
(X, (Y, Z)) Function<X, Y, Z>(X x, Y y, Z z) f, int x, String y, bool? z) {}
class A8<X extends (X, Y), Y extends num> {}
foo8(A8 a) {}
class A9<X extends (Y, Z), Y extends num, Z extends String?> {}
foo9(A9 a) {}
class A10<X, Y> {}
A10<(T, T), T> foo10<T>() => throw 0;
bar10() {}
main() {}

View file

@ -0,0 +1,20 @@
A10<(T, T), T> foo10<T>() => throw 0;
bar10() {}
class A10<X, Y> {}
class A8<X extends (X, Y), Y extends num> {}
class A9<X extends (Y, Z), Y extends num, Z extends String?> {}
foo1((int, String?) r) {}
foo2((int, String?) r, X Function<X>() f) {}
foo3() {}
foo4() {}
foo5((int, String?) r, (int, X) Function<X>() f) {}
foo6((X, Y) Function<X, Y>(X x, Y y) f, int x, String y) {}
foo7(
(X, (Y, Z)) Function<X, Y, Z>(X x, Y y, Z z) f, int x, String y, bool? z) {}
foo8(A8 a) {}
foo9(A9 a) {}
main() {}

View file

@ -0,0 +1,2 @@
void method1([a = (0, 1), b = (const <String>[], c: 'foo')]) {}
void method2({a = (0, 1), b = (const <String>[], c: 'foo')}) {}

View file

@ -1,4 +1,5 @@
abstract class A<X> {}
typedef R = Record;
typedef AR = A<Record>;
typedef RR = R;
@ -19,13 +20,21 @@ RR foo11() => throw '';
dynamic foo12(R r) => null;
dynamic foo13(AR l) => null;
dynamic foo14(RR l) => null;
abstract class A1 extends A<Record> {}
abstract class A2 implements A<Record> {}
abstract class A3 with A<Record> {}
abstract class A4 extends AR {}
abstract class A5 extends AR2 {}
abstract class A6 extends AR3 {}
abstract class A7 extends AR4 {}
foo((int, String) record) {}
bar(Record record) {}
main() {}

View file

@ -0,0 +1,40 @@
AR foo10() => throw '';
List<Record> foo7() => throw '';
R foo9() => throw '';
RR foo11() => throw '';
Record foo1() => throw '';
abstract class A<X> {}
abstract class A1 extends A<Record> {}
abstract class A2 implements A<Record> {}
abstract class A3 with A<Record> {}
abstract class A4 extends AR {}
abstract class A5 extends AR2 {}
abstract class A6 extends AR3 {}
abstract class A7 extends AR4 {}
bar(Record record) {}
dynamic foo12(R r) => null;
dynamic foo13(AR l) => null;
dynamic foo14(RR l) => null;
dynamic foo2() => <Record>[];
dynamic foo3() => Record;
dynamic foo4() => List<Record>;
dynamic foo5(Record r) => null;
dynamic foo6({required Record r}) => null;
dynamic foo8(List<Record> l) => null;
foo((int, String) record) {}
main() {}
typedef AR = A<Record>;
typedef AR2 = A<R>;
typedef AR3 = A<RR>;
typedef AR4 = A<AR>;
typedef R = Record;
typedef RR = R;

View file

@ -0,0 +1,4 @@
f() sync* {}
g() sync* => dummy;
h() sync* {}
main() {}

View file

@ -1,3 +1,4 @@
sealed class A {}
mixin M {}
sealed class B = Object with M;

View file

@ -0,0 +1,5 @@
mixin M {}
sealed class A {}
sealed class B = Object with M;

View file

@ -1,2 +1 @@
sealed
mixin M {}
sealed mixin M {}

View file

@ -0,0 +1,4 @@
---- unknown chunk starts ----
sealed
---- unknown chunk ends ----
mixin M {}

View file

@ -21,20 +21,7 @@ regress/issue_39035.crash: EmptyOutput
regress/issue_39091_2: EmptyOutput
regress/utf_16_le_content.crash: EmptyOutput
class_modifiers/anonymous_mixin: FormatterCrash
class_modifiers/base/base_class_declaration: FormatterCrash
class_modifiers/base/base_subtype_not_base_final_sealed: FormatterCrash
class_modifiers/base/outside_library/main: FormatterCrash
class_modifiers/base/typedef/main: FormatterCrash
class_modifiers/final/final_class_declaration: FormatterCrash
class_modifiers/final/final_subtype_not_base_final_sealed: FormatterCrash
class_modifiers/final/outside_library/main: FormatterCrash
class_modifiers/final/typedef/main: FormatterCrash
class_modifiers/interface/interface_class_declaration: FormatterCrash
class_modifiers/mixin/mixin_class_declaration: FormatterCrash
class_modifiers/mixin/mixin_class_generative_constructor: FormatterCrash
class_modifiers/mixin/mixin_class_invalid_modifiers: FormatterCrash
class_modifiers/mixin/mixin_class_superclass_not_object: FormatterCrash
const_functions/const_functions_const_ctor: FormatterCrash
const_functions/const_functions_const_ctor_error: FormatterCrash
const_functions/const_functions_const_factory: FormatterCrash
@ -98,7 +85,6 @@ general/error_recovery/issue_39230.crash: FormatterCrash
general/error_recovery/issue_39958_01: FormatterCrash
general/error_recovery/issue_43090.crash: FormatterCrash
general/extension_types_feature_not_enabled: FormatterCrash
general/final_class_declaration: FormatterCrash
general/function_type_default_value: FormatterCrash
general/incomplete_field_formal_parameter: FormatterCrash
general/inline_class_declaration: FormatterCrash
@ -124,12 +110,10 @@ general/macro_class: FormatterCrash
general/many_errors2: FormatterCrash
general/many_errors: FormatterCrash
general/missing_prefix_name: FormatterCrash
general/mixin_class_declaration: FormatterCrash
general/new_as_selector: FormatterCrash
general/null_aware_super: FormatterCrash
general/null_safety_invalid_experiment: FormatterCrash
general/null_safety_invalid_experiment_and_language_version: FormatterCrash
general/records: FormatterCrash
general/records_opt_out: FormatterCrash
general/sealed_class_declaration: FormatterCrash
general/type_parameters_on_void: FormatterCrash
@ -172,21 +156,8 @@ nnbd_mixed/inheritance_from_opt_in: FormatterCrash
nnbd_mixed/issue41597: FormatterCrash
nnbd_mixed/null_safety_invalid_language_version: FormatterCrash
nonfunction_type_aliases/old_version: FormatterCrash
patterns/if_else_in_collections_errors: FormatterCrash
patterns/issue51489: FormatterCrash
patterns/pattern_matching: FormatterCrash
patterns/pattern_types: FormatterCrash
patterns/records/destructuring: FormatterCrash
patterns/records/record_pattern_inside_if_case: FormatterCrash
patterns/simple_c_style_pattern_for_in_collections: FormatterCrash
patterns/simple_if_case_in_lists: FormatterCrash
patterns/simple_if_case_map_entries: FormatterCrash
patterns/switchExpression_empty: FormatterCrash
patterns/switchExpression_onePattern_guarded: FormatterCrash
patterns/switchExpression_onePattern_noTrailingComma: FormatterCrash
patterns/switchExpression_onePattern_trailingComma: FormatterCrash
patterns/switchExpression_twoPatterns: FormatterCrash
patterns/switch_expressions_variable_capture: FormatterCrash
rasta/bad_redirection: FormatterCrash
rasta/issue_000032: FormatterCrash
rasta/issue_000034: FormatterCrash
@ -196,37 +167,15 @@ rasta/issue_000046: FormatterCrash
rasta/issue_000047: FormatterCrash
rasta/malformed_const_constructor: FormatterCrash
rasta/mandatory_parameter_initializer: FormatterCrash
records/access_through_type_variable: FormatterCrash
records/block_combine_statements: FormatterCrash
records/const_local_access: FormatterCrash
records/const_record_literal: FormatterCrash
records/duplicated_name_errors: FormatterCrash
records/for_in_without_variable: FormatterCrash
records/issue50132: FormatterCrash
records/issue50133: FormatterCrash
records/issue50157: FormatterCrash
records/issue50182: FormatterCrash
records/issue50514: FormatterCrash
records/issue50515: FormatterCrash
records/metadata: FormatterCrash
records/named_fields_clashing_with_positional: FormatterCrash
records/names_of_positional_fields_same_as_object_members: FormatterCrash
records/null_shorting: FormatterCrash
records/nullable_access: FormatterCrash
records/nullable_access_extension: FormatterCrash
records/private_field_names: FormatterCrash
records/record_literal_errors: FormatterCrash
records/record_type: FormatterCrash
records/record_type_errors: FormatterCrash
records/record_type_unsupported: FormatterCrash
records/restricted_object_member_names: FormatterCrash
records/simple_inference: FormatterCrash
records/structurally_constant: FormatterCrash
records/type_record: FormatterCrash
regress/ambiguous_builder_01: FormatterCrash
regress/issue_29942: FormatterCrash
regress/issue_29944: FormatterCrash
regress/issue_29983: FormatterCrash
regress/issue_29986: FormatterCrash
regress/issue_30834: FormatterCrash
regress/issue_30981: FormatterCrash
@ -250,8 +199,6 @@ regress/issue_41265.crash: Crash
regress/issue_41265.crash: FormatterCrash
sealed_class/sealed_abstract_class_declaration: FormatterCrash
sealed_class/sealed_class_as_mixin: FormatterCrash
sealed_class/sealed_class_declaration: FormatterCrash
sealed_class/sealed_mixin_declaration: FormatterCrash
super_parameters/issue47741: FormatterCrash
super_parameters/issue47922: FormatterCrash
super_parameters/issue48714: FormatterCrash