blob: f3e2a636042c558bd0e1a8483fb844f11ed6044a [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.
// @dart = 2.9
/// @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 iarkh@unipro.ru
import "../../Utils/expect.dart";
main() {
const String str = false ? (null as String).length : "OK";
Expect.equals("OK", str);
}