blob: e2e3b61b8ec5c4594a2c6db57f6808d96af7f91b [file] [log] [blame] [edit]
// Copyright (c) 2023, 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 The lifted space union for a pattern with matched value type M is
/// ...
/// Variable pattern or identifier pattern: The lifted space union of the static
/// type of the corresponding variable.
///
/// @description Check that a lifted space for a variable pattern is a union of
/// the static type of the corresponding variable.
/// @author sgrekhov22@gmail.com
import "../../../Utils/expect.dart";
String test1(bool o) {
switch (o) {
case bool _b:
return "exhaustive";
}
}
String test2(bool o) => switch (o) {
var v => "exhaustive"
};
main() {
Expect.equals("exhaustive", test1(true));
Expect.equals("exhaustive", test1(false));
Expect.equals("exhaustive", test2(true));
Expect.equals("exhaustive", test2(false));
}