blob: b6679cb9a2c63759d4c2c5d3930335b27d319db2 [file] [log] [blame]
// Copyright (c) 2021, 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 enum declaration contains any
/// generative constructor which is not const.
// We can allow omitting the const on constructors since it’s required, so we
// can just assume it’s there. That’s a convenience we can also add at any later
// point.
/// @description Check that non constant factory constructor is allowed
/// @author
// SharedOptions=--enable-experiment=enhanced-enums
import "../../Utils/expect.dart";
enum E {
const E();
factory E.f() => e1;
E get getInstance => E.f();
main() {
Expect.equals(E.e1, E.e2.getInstance);