Files
sdk/pkg/front_end/testcases/patterns/issue51432.dart
T
Johnni Winther 210275c1fe [cfe] Use AsExpression for AssignedVariablePattern lowering
The lowering previously used a PromotedCachableExpression, therefore
missing the needed check on assignment.

Closes #51432

Change-Id: I9e671326df25add9a8abea03d1e52b1be5740adc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289901
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-24 00:10:07 +00:00

25 lines
506 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.
method() {
int v1 = 42;
(v1) = ("The string!") as dynamic;
print(v1); // The string!
print(v1.runtimeType); // String
}
main() {
throws(() => method());
}
throws(void Function() f) {
try {
f();
} catch (e) {
print(e);
return;
}
throw 'Missing exception';
}