70d3adade2
This moves the hoisted declaration of pattern variables till after the variable cache declarations, such that any use of variables in the matched expression, shadowed by the pattern variables, occurs before the declaration of the shadowing variables. Closes #54559 Change-Id: Id8ca8e7a499b9d71a50cd9987808d159f26bbd24 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345942 Reviewed-by: Erik Ernst <eernst@google.com> Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
13 lines
400 B
Dart
13 lines
400 B
Dart
// Copyright (c) 2024, 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.
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
void main() {
|
|
String? fooValue = 'hello world';
|
|
if (fooValue case final String fooValue) {
|
|
Expect.equals('hello world', fooValue);
|
|
}
|
|
}
|