9abc9fc4d7
A line marked with "// error" should get an error (or it's an error), and one marked with "// ok" should not get an error (and if it does it's an error). Some tests are left unhandled and are programatically ignored in this first CL. A bug (https://github.com/dart-lang/sdk/issues/54635) has been filed to sort those out. Change-Id: I083f62829ceff6ff85121e21cfdb6670bfacb7e6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346301 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
23 lines
608 B
Dart
23 lines
608 B
Dart
// 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.
|
|
|
|
test(dynamic x) {
|
|
switch (x) {
|
|
case int y when y == 0:
|
|
case [var y] when y == 0:
|
|
// Error
|
|
return y;
|
|
case int y when y == 0:
|
|
case [final int y] when y == 0:
|
|
// Error
|
|
return y;
|
|
case int y || [var y] when y == 0: // Error.
|
|
return y;
|
|
case int y || [final int y] when y == 0: // Error.
|
|
return y;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|