blob: ce199aa9a30903d0b4638c432fc5c2980828fe50 [file] [log] [blame]
// Copyright (c) 2019, 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 Finally, the conditional [?]/[:] operator only evaluates one of
/// its branches, depending on whether the condition expression evaluates to
/// [true] or [false]. The other branch must also be a potentially constant
/// expression.
/// @description Checks that conditional operator [?]/[:] rejects the first
/// operand if condition is [false] for constant expressions.
/// @author
import "../../Utils/expect.dart";
class MyClass {
final bool res;
const MyClass() : res = (false ? (null as String).length < 1 : true);
main() {
const MyClass c = MyClass();