Files
Alexander Markov 946bb79832 [modular_aot] Support undefined value of local variables
Issue: https://github.com/dart-lang/sdk/issues/61635
Change-Id: Ic785f47da63511023de09167dd2787337a46f8f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/498200
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2026-04-27 07:40:35 -07:00

40 lines
672 B
Dart

// Copyright (c) 2026, 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.
String test1(Object x) => switch (x) {
String s => s,
int i => "$i",
_ => throw ArgumentError(),
};
abstract class A {
Object get x;
}
abstract class B {
A get a;
}
void test2(B obj) {
if (obj.a.x case [String path]) {
print(path);
}
}
abstract class C {
D get d;
}
abstract class D {
List<String>? operator [](String name);
}
void test3(C obj) {
if (obj.d['foo'] case [String path]) {
print(path);
}
}
void main() {}