Skip to content

Commit

Permalink
#2559. Update assertions for redirecting generative constructors tests (
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Dec 12, 2024
1 parent 714a310 commit ee06c5d
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Redirecting generative constructors
/// @assertion It is a compile-time error if:
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The resulting constructor is not valid (it has a redirection as well as
/// some initializer list elements, or it has multiple super initializers,
/// etc).
///
/// @description Checks that it is a compile-time error if a merged constructor
/// is cyclic.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

part 'augmenting_constructors_A18_t05_lib.dart';
part 'augmenting_constructors_A06_t03_lib.dart';

class C {
C();
C.foo();
}

enum E {
e0;
const E();
const E.foo();
}

extension type ET(int v) {
ET.foo(int v);
}

main() {
print(C);
print(E);
print(ET);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion It is a compile-time error if:
/// ...
/// - The resulting constructor is not valid (it has a redirection as well as
/// some initializer list elements, or it has multiple super initializers,
/// etc).
///
/// @description Checks that it is a compile-time error if a merged constructor
/// is cyclic.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

part of 'augmenting_constructors_A06_t03.dart';

augment class C {
augment C() : this();
// ^
// [analyzer] unspecified
// [cfe] unspecified
augment C.foo() : this.foo();
// ^
// [analyzer] unspecified
// [cfe] unspecified
}

augment enum E {
augment e0;
augment const E() : this();
// ^
// [analyzer] unspecified
// [cfe] unspecified
augment const E.foo() : this.foo();
// ^
// [analyzer] unspecified
// [cfe] unspecified
}

augment extension type ET {
augment ET(int v) : this.foo(v);
// ^
// [analyzer] unspecified
// [cfe] unspecified
augment ET.foo(int v) : this.foo(v);
// ^
// [analyzer] unspecified
// [cfe] unspecified
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Redirecting generative constructors
/// @assertion It is a compile-time error if:
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The resulting constructor is not valid (it has a redirection as well as
/// some initializer list elements, or it has multiple super initializers,
/// etc).
///
/// @description Checks that it is a compile-time error if a merged constructor
/// is cyclic.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

part 'augmenting_constructors_A18_t07_lib.dart';
part 'augmenting_constructors_A06_t04_lib.dart';

class C {
C();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

/// @assertion Redirecting generative constructors
/// @assertion It is a compile-time error if:
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The resulting constructor is not valid (it has a redirection as well as
/// some initializer list elements, or it has multiple super initializers,
/// etc).
///
/// @description Checks that it is a compile-time error if a merged constructor
/// is cyclic.
/// @author sgrekhov22@gmail.com
// SharedOptions=--enable-experiment=macros

part of 'augmenting_constructors_A18_t07.dart';
part of 'augmenting_constructors_A06_t04.dart';

augment class C {
augment C(): this.foo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The augmented constructor has any initializers.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if the augmented constructor has
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The augmented constructor has any initializers.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if the augmented constructor has
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The augmented constructor has any initializers.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if the augmented constructor has a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The augmented constructor has any initializers.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if the augmented constructor has a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The augmented constructor has any initializers.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if the augmented constructor has a super
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// - The augmented constructor has any initializers.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if the augmented constructor has a super
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// ...
/// - The augmented constructor has a redirection.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor more than once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// ...
/// - The augmented constructor has a redirection.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor more than once.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// ...
/// - The augmented constructor has a body.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if an introductory constructor has a body
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
/// @assertion Redirecting generative constructors
/// ...
/// It is a compile-time error if:
/// - The augmented constructor has an initializer list or a body, or it has a
/// redirection.
/// ...
/// - The augmented constructor has a body.
///
/// @description Checks that it is a compile-time error to declare an augmenting
/// redirecting generative constructor if an introductory constructor has a body
Expand Down

0 comments on commit ee06c5d

Please sign in to comment.