Fix SubMov copying

This commit is contained in:
Andrew Morris
2023-06-20 14:58:23 +10:00
parent 7e16156933
commit 4e91cf3b20
2 changed files with 14 additions and 8 deletions

View File

@@ -1,13 +1,15 @@
//! test_output(2)
// Should be: 1
/// <reference path="../../../concept-code/vs.d.ts" />
export default function main() {
const x = Debug.makeCopyCounter("x");
let obj: Record<string, unknown> = { x }; // Single copy occurs here
obj.y = "y"; // Shouldn't copy, but does
let obj: Record<string, unknown> = { x }; // First copy
obj.y = "y"; // No extra copy
let arr: unknown[] = [x]; // Second copy
arr[1] = "y"; // No extra copy
return x.count;
}