diff --git a/TypeSystem/flow-analysis/reachability_while_A02_t01.dart b/TypeSystem/flow-analysis/reachability_while_A02_t01.dart index 7af674e966..9db715cb10 100644 --- a/TypeSystem/flow-analysis/reachability_while_A02_t01.dart +++ b/TypeSystem/flow-analysis/reachability_while_A02_t01.dart @@ -12,7 +12,12 @@ /// detects assignment in `S`. /// @author sgrekhov22@gmail.com -main() { +class C { + int v; + C(this.v); +} + +test1() { try { late int i; while (1 > 2) { @@ -21,3 +26,40 @@ main() { i; // Not definitely unassigned } catch (_) {} } + +test2() { + try { + late int i; + while (1 > 2) { + (i,) = (42,); + } + i; // Not definitely unassigned + } catch (_) {} +} + +test3() { + try { + late int i; + while (1 > 2) { + (x: i) = (x: 42); + } + i; // Not definitely unassigned + } catch (_) {} +} + +test4() { + try { + late int i; + while (1 > 2) { + C(v: i) = C(42); + } + i; // Not definitely unassigned + } catch (_) {} +} + +main() { + test1(); + test2(); + test3(); + test4(); +} diff --git a/TypeSystem/flow-analysis/reachability_while_A02_t02.dart b/TypeSystem/flow-analysis/reachability_while_A02_t02.dart index d41f6250de..d1b40f89f9 100644 --- a/TypeSystem/flow-analysis/reachability_while_A02_t02.dart +++ b/TypeSystem/flow-analysis/reachability_while_A02_t02.dart @@ -12,7 +12,12 @@ /// detects assignment in `S`. /// @author sgrekhov22@gmail.com -main() { +class C { + int v; + C(this.v); +} + +test1() { try { late int i; while (1 > 2) { @@ -23,3 +28,46 @@ main() { i; // Not definitely unassigned } catch (_) {} } + +test2() { + try { + late int i; + while (1 > 2) { + () { + (i,) = (42,); + }; + } + i; // Not definitely unassigned + } catch (_) {} +} + +test3() { + try { + late int i; + while (1 > 2) { + () { + (x: i) = (x: 42); + }; + } + i; // Not definitely unassigned + } catch (_) {} +} + +test4() { + try { + late int i; + while (1 > 2) { + () { + C(v: i) = C(42); + }; + } + i; // Not definitely unassigned + } catch (_) {} +} + +main() { + test1(); + test2(); + test3(); + test4(); +}