From 5b027b995e9a797a34f14ad444c3ce769f2912ee Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Mon, 15 Sep 2025 17:56:52 -0500 Subject: [PATCH] Fix motion_turnleft and motion_turnright missing type casts --- src/compiler/irgen.js | 4 ++-- ...-rotate-by-decimal-without-leading-zero.sb3 | Bin 0 -> 2784 bytes ...ecimal-without-leading-zero.sb3.tw-snapshot | 17 +++++++++++++++++ ...ecimal-without-leading-zero.sb3.tw-snapshot | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/execute/tw-rotate-by-decimal-without-leading-zero.sb3 create mode 100644 test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot create mode 100644 test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot diff --git a/src/compiler/irgen.js b/src/compiler/irgen.js index e84cbc21e5a..2a22749b345 100644 --- a/src/compiler/irgen.js +++ b/src/compiler/irgen.js @@ -865,14 +865,14 @@ class ScriptTreeGenerator { return new IntermediateStackBlock(StackOpcode.MOTION_DIRECTION_SET, { direction: new IntermediateInput(InputOpcode.OP_SUBTRACT, InputType.NUMBER, { left: new IntermediateInput(InputOpcode.MOTION_DIRECTION_GET, InputType.NUMBER), - right: this.descendInputOfBlock(block, 'DEGREES') + right: this.descendInputOfBlock(block, 'DEGREES').toType(InputType.NUMBER) }) }); case 'motion_turnright': return new IntermediateStackBlock(StackOpcode.MOTION_DIRECTION_SET, { direction: new IntermediateInput(InputOpcode.OP_ADD, InputType.NUMBER, { left: new IntermediateInput(InputOpcode.MOTION_DIRECTION_GET, InputType.NUMBER), - right: this.descendInputOfBlock(block, 'DEGREES') + right: this.descendInputOfBlock(block, 'DEGREES').toType(InputType.NUMBER) }) }); diff --git a/test/fixtures/execute/tw-rotate-by-decimal-without-leading-zero.sb3 b/test/fixtures/execute/tw-rotate-by-decimal-without-leading-zero.sb3 new file mode 100644 index 0000000000000000000000000000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lWNW0oKE56sMsly_^LE!qAwch zV7&lp4p$Whn2~AwkJ7#q{b3cZ+Ml;F_6Ny}Q*VOF9%N_rOQF}gaUnF%&VvPOe6;w{ z?Tar%p7{2!{0=PMz#gYeb!uvgD9Uu2`4h{Yjzna{Cu<~ezdQ^*YfVz(tupt|<%~{~ z95B61=7e^Cs5l*F{Sfm`8s+gids&w8dGKN)KGeb?3g{s9F}5#Y9x|+diTCqab5tU) zqW}u}<Yf~gUZ`7hO}lYV#duAXFA0N_7a*xTCx literal 0 HcmV?d00001 diff --git a/test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot b/test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot new file mode 100644 index 00000000000..d92f0cf7405 --- /dev/null +++ b/test/snapshot/__snapshots__/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot @@ -0,0 +1,17 @@ +// TW Snapshot +// Input SHA-256: 0a7a3ee1aac2ba5b063f53b742ef992e395ee668efa9205279f93f1949e8a755 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +target.setDirection(90); +target.setDirection((target.direction + 0.25)); +target.setDirection((target.direction + 0.25)); +if ((target.direction === 90.5)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; }) diff --git a/test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot b/test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot new file mode 100644 index 00000000000..d92f0cf7405 --- /dev/null +++ b/test/snapshot/__snapshots__/warp-timer/tw-rotate-by-decimal-without-leading-zero.sb3.tw-snapshot @@ -0,0 +1,17 @@ +// TW Snapshot +// Input SHA-256: 0a7a3ee1aac2ba5b063f53b742ef992e395ee668efa9205279f93f1949e8a755 + +// Sprite1 script +(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage(); +const b0 = runtime.getOpcodeFunction("looks_say"); +return function* genXYZ () { +yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null); +target.setDirection(90); +target.setDirection((target.direction + 0.25)); +target.setDirection((target.direction + 0.25)); +if ((target.direction === 90.5)) { +yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null); +} +yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null); +retire(); return; +}; })