diff --git a/Compiler/src/Compiler.cpp b/Compiler/src/Compiler.cpp index a7eedfc4..7bb70201 100644 --- a/Compiler/src/Compiler.cpp +++ b/Compiler/src/Compiler.cpp @@ -1131,7 +1131,7 @@ struct Compiler } // disable fast path for vectors because supporting it would require a new opcode - if (isConstantVector(right)) + if (operandIsConstant && isConstantVector(right)) operandIsConstant = false; uint8_t rl = compileExprAuto(left, rs); diff --git a/tests/Compiler.test.cpp b/tests/Compiler.test.cpp index 4f2f7ac2..112c58e9 100644 --- a/tests/Compiler.test.cpp +++ b/tests/Compiler.test.cpp @@ -4498,12 +4498,12 @@ TEST_CASE("VectorLiterals") { ScopedFastFlag sff("LuauVectorLiterals", true); - CHECK_EQ("\n" + compileFunction("return Vector3.new(1, 2, 3)", 0, 2, true), R"( + CHECK_EQ("\n" + compileFunction("return Vector3.new(1, 2, 3)", 0, 2, /*enableVectors*/ true), R"( LOADK R0 K0 [1, 2, 3] RETURN R0 1 )"); - CHECK_EQ("\n" + compileFunction("print(Vector3.new(1, 2, 3))", 0, 2, true), R"( + CHECK_EQ("\n" + compileFunction("print(Vector3.new(1, 2, 3))", 0, 2, /*enableVectors*/ true), R"( GETIMPORT R0 1 [print] LOADK R1 K2 [1, 2, 3] CALL R0 1 0