blob: e6bf9c6a965ee9450481b17ff4b1f92b3d0524e5 [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.
// Tests const factories with const functions disabled.
import "package:expect/expect.dart";
const printConst = MessageType.parse("print");
class MessageType {
static const print = MessageType._('print');
static const skip = MessageType._('skip');
final String name;
const factory MessageType.parse(String name) {
// [cfe] Only redirecting factory constructors can be declared to be 'const'.
if (name == 'print') {
return MessageType.print;
return MessageType.skip;
const MessageType._(;