Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
// 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 introductory constructor has a super initializer (super constructor
/// invocation at the end of the initializer list) and the augmenting
/// constructor does too.
/// @assertion It's a compile-time error if an augmentation is complete and any
/// declaration before it in the augmentation chain is also complete.
///
/// @description Checks that it is a compile-time error if the introductory
/// constructor has a super initializer and the augmenting constructor does too.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=macros

part 'augmenting_constructors_A05_t01_lib.dart';
// SharedOptions=--enable-experiment=augmentations

class A {
int x;
Expand All @@ -26,10 +21,24 @@ class C1 extends A {
C1(): super(0);
}

augment class C1 {
augment C1(): super(0);
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

class C2 extends A {
C2(): super(0);
}

augment class C2 {
augment C2(): super.foo(0);
// ^^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(C1);
print(C2);
Expand Down

This file was deleted.

49 changes: 38 additions & 11 deletions LanguageFeatures/Augmentations/augmenting_constructors_A06_t01.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,56 @@
// 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).
/// @assertion It's a compile-time error if an augmentation is complete and any
/// declaration before it in the augmentation chain is also complete.
///
/// @description Checks that it is a compile-time error if the resulting
/// constructor has a redirecting initializer and initializer list elements.
/// @description Checks that it is a compile-time error if the introductory
/// constructor has a redirecting initializer and the augmenting has initializer
/// list elements.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=macros

part 'augmenting_constructors_A06_t01_lib.dart';
// SharedOptions=--enable-experiment=augmentations

class C {
int x;
C(this.x);
C.foo() : this(0);
//^^^^^
}

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

enum E {
e0.foo();
final int x;
const E(this.x);
const E.foo() : this(0);
}

augment enum E {
augment const E.foo() : x = 1;
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

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

augment extension type ET {
augment ET.foo() : x = 1;
// ^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(C);
print(E);
print(ET);
}

This file was deleted.

22 changes: 11 additions & 11 deletions LanguageFeatures/Augmentations/augmenting_constructors_A06_t02.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
// 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).
/// @assertion It's a compile-time error if an augmentation is complete and any
/// declaration before it in the augmentation chain is also complete.
///
/// @description Checks that it is a compile-time error if the resulting
/// constructor has multiple super initializers.
/// @description Checks that it is a compile-time error if the introductory and
/// augmenting constructors have multiple super initializers.
/// @author sgrekhov22@gmail.com

// SharedOptions=--enable-experiment=macros

part 'augmenting_constructors_A06_t02_lib.dart';
// SharedOptions=--enable-experiment=augmentations

class A {
int x;
Expand All @@ -23,11 +18,16 @@ class A {

class C extends A {
C() : super(0);
//^
}

augment class C {
augment C() : super(1);
// ^
// [analyzer] unspecified
// [cfe] unspecified
}


main() {
print(C);
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,67 @@
// 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).
/// @assertion The general rule is that compile-time errors apply to semantic
/// definitions whenever possible. In other words, if the library is
/// syntactically well-formed enough that augmentations can be applied, then
/// they should be. And if doing so eliminates what would otherwise be a
/// compile-time error, then that error should not be reported.
///
/// @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_A06_t03_lib.dart';
// SharedOptions=--enable-experiment=augmentations

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

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

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

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

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

augment extension type ET {
augment ET(int v) : this.foo(v);
// ^
// [analyzer] unspecified
// [cfe] unspecified
augment ET.foo(int v) : this(v);
// ^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(C);
print(E);
Expand Down

This file was deleted.

Loading
Loading