[tests] Primary constructors - Allow ; bodies on any membered declarations.
Updating some primary constructor tests in light of issue 4645 that allows `;` on any membered declarations. Bug: https://github.com/dart-lang/language/issues/4645, https://github.com/dart-lang/sdk/issues/61687 Change-Id: I390ccd1eb1c84d55ee599d4d94ab199bb4920880 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/485585 Commit-Queue: Kallen Tu <kallentu@google.com> Reviewed-by: Erik Ernst <eernst@google.com>
This commit is contained in:
@@ -2,28 +2,11 @@
|
||||
// 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.
|
||||
|
||||
// For mixins, an empty body, `{}`, cannot be replaced by `;`. Enums require a
|
||||
// non-empty declaration.
|
||||
// Enums that have an empty body (i.e. `;`) can be parsed, but will cause a
|
||||
// compile-time error when there's no enum constant declared.
|
||||
|
||||
// SharedOptions=--enable-experiment=primary-constructors
|
||||
|
||||
class C1;
|
||||
|
||||
mixin M1;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
mixin M2 implements C1;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
mixin M3 on C1;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
|
||||
enum E1;
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
|
||||
@@ -2,28 +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.
|
||||
|
||||
// An empty class body, `{}`, can be replaced by `;`.
|
||||
// An empty declaration body, `{}`, can be replaced by `;`.
|
||||
|
||||
// SharedOptions=--enable-experiment=primary-constructors
|
||||
|
||||
// Classes
|
||||
class C1;
|
||||
|
||||
class C2 with M1;
|
||||
|
||||
class C3(var int x) extends C1;
|
||||
|
||||
mixin class M1 implements C1;
|
||||
|
||||
mixin class M2;
|
||||
|
||||
// Extension types
|
||||
extension type E1(int x);
|
||||
|
||||
extension type const E2(int x);
|
||||
|
||||
// Mixin classes
|
||||
mixin class M1 implements C1;
|
||||
|
||||
class M1With with M1;
|
||||
|
||||
mixin class M2;
|
||||
|
||||
class M2With with M2;
|
||||
|
||||
// Mixins
|
||||
mixin M3;
|
||||
|
||||
class M3With with M3;
|
||||
|
||||
mixin M4 implements C1;
|
||||
|
||||
class M4With with M4;
|
||||
|
||||
mixin M5 on C1;
|
||||
|
||||
class M5With extends C1 with M5;
|
||||
|
||||
// Extension
|
||||
extension Ext1 on C1;
|
||||
|
||||
void main() {
|
||||
print(C1());
|
||||
print(C2());
|
||||
print(C3(1));
|
||||
print(E1(1));
|
||||
print(E2(1));
|
||||
print(M1With());
|
||||
print(M2With());
|
||||
print(M3With());
|
||||
print(M4With());
|
||||
print(M5With());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user