Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions BACKLOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,49 @@ Notes; finished-work narrative does not.
failures into ordinary regressions. Add metamorphic checks that replace interface calls with
concrete calls while keeping observable behavior unchanged.

- **Run every executing test on Lua on master CI (`-PallBackends`).** Forcing `translateAndTestLua`
after the Jass runs of every `executeProg` test that does not opt into Lua (686 tests, October 2026)
passed 645 on plain Lua and 644 with `-inline -localOptimizations`; the failures found the
generic-static, `wurstKeyOf` and type-id items below, two defects with their own fixes (compile-time
object ids, old-generic tuple arguments) and 24 tests stopped by natives missing from `wc3shim.lua`. The two Lua variants
cost about 300 s of test time each over the suite. Proposal: `-PallBackends` (master CI only, PR CI
unchanged) runs Lua after Jass for every executing test, `-PallBackends=full` adds the inlined
variant. A test that cannot hold on Lua says why with `.luaExempt(LuaExemption.X)` instead of
`testLua(false)`: an enum whose every reason names its record (`REAL_EQUALITY_TOLERANCE`, AGENTS.md §7;
`CLASS_AND_METHOD_TYPE_PARAMS`, §9; `TEST_LUA_COMPUTES_IN_DOUBLE`, docs/WC3_RUNTIME.md "Numbers";
`INTERPRETER_MOCK_ONLY`; `MISSING_TEST_NATIVE` with the native's name; `KNOWN_LUA_DEFECT` with the
backlog item). In that mode an exempt test still runs on Lua and must fail there, so a stale
exemption fails the run (21 of 48 `testLua(false)` were stale and now run Lua). Land the shim natives
first. `executeTests()` (Wurst `@Test` functions) has no Lua path in the harness at all.

- **A generic class's static is dropped on Lua when only a static inner class reads it.**
`GenericsWithTypeclassesTests.genericClassWithStaticInnerClass` and `genericModuleThistypeSmall` pass
on the interpreter and Jass and fail on Lua, also after #1498; neither opts into Lua. In
`class Outer<T:>` with `static T t`, the specialised constructor's `t = iVal` is not emitted and
`Inner.next()` reads the erased `Outer_t`, which stays nil. A static function of `Outer` reading `t`
instead passes on both Lua variants, so the reader in the unspecialised inner class splits the store.
The module form (`static thistype t` in a module used by `class A<T:>`) loses `t = this` the same way
with `-inline -localOptimizations`, and without it the Lua translation crashes in
`TypeSubst.resolve` ("Could not find replacement for T... when replacing [T...] with []"), from
`ExprTranslation.translateEquals` typing `a.iterator().next()`. Fix in `EliminateGenerics`, where the
store is split, and turn on `testLua(true).luaOnly(false)` for both tests.

- **A direct `wurstKeyOf` call answers its placeholder on Lua.** `KeyedTableTests.intKeyIsIdentity`
(`wurstKeyOf(7)` is 0) and `classInstanceKeyIsStable` (two instances share key 0) pass on the
interpreter and Jass and fail on Lua: the emitted `wurstKeyOf` is its source body, `return 0`. On Lua
the keyed-table operations are replaced as a whole (`LuaNativeLowering.lowerKeyedTables`), and the
tests' class calls itself "the Jass side", but nothing stops a program from calling the intrinsic
directly, and that placeholder answer is the failure `lowerKeyedTables` was moved to avoid. Either
lower it on Lua (the value itself for `int` and class instances, the handle id for handles) or reject
a direct call there with a diagnostic (AGENTS.md §3: no silent fallback).

- **`typeIdToTypeName`, `maxTypeId`, `instanceCount` and `maxInstanceCount` answer defaults on Lua.**
Only `EliminateClasses` implements them, on the Jass path. On Lua they compile to the generic native
fallback, which returns `""` or 0 without a diagnostic, so `NewFeatureTests.typeName`, `typeName2`,
`maxTypeId`, `instanceCount` and `instanceMaxCount` hold only with `testLua(false)`. Nothing documents
this as a backend difference. Implement them on Lua (one id space for every class, docs/WC3_RUNTIME.md
"Objects and memory", so `instanceCount` counts one class's live descriptors) or reject them there.

- **Represent raw Lua helper bindings structurally.** Lua name compression now runs after backend
lowering so it includes descriptors, field storage and resolved dispatch slots. `LuaLiteral` still
embeds helper bindings and references as text (for example the object/string index helpers), so
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ public void ondestroy() {
public void recyling() {
test().executeProg(true)
.executeProgOnlyAfterTransforms()
.testLua(false)
.testLua(true).luaOnly(false)
.lines(
"package test",
" native testSuccess()",
Expand Down Expand Up @@ -1079,7 +1079,7 @@ public void recyling() {
public void recyling2() {
test().executeProg(true)
.executeProgOnlyAfterTransforms()
.testLua(false)
.testLua(true).luaOnly(false)
.lines(
"package test",
" native testSuccess()",
Expand All @@ -1106,7 +1106,7 @@ public void recyling2() {
public void recyling_random() {
test().executeProg(true)
.executeProgOnlyAfterTransforms()
.testLua(false)
.testLua(true).luaOnly(false)
.lines(
"package test",
" native testSuccess()",
Expand Down Expand Up @@ -1786,7 +1786,7 @@ public void duplicateConstructor() {
@Test
public void thisHandling() { // see bug #145
test().executeProg(true)
.testLua(false)
.testLua(true).luaOnly(false)
.lines(
"package test",
" native testSuccess()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ public void skipInClosure_fail() {
@Test
public void testDispatch() {
test().executeProg(true)
.testLua(false)
.testLua(true).luaOnly(false)
.executeProgOnlyAfterTransforms()
.lines(
"package A",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void cellExample() {

@Test
public void implicitConversions() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package test",
" native testSuccess()",
" class Cell<T>",
Expand Down Expand Up @@ -211,7 +211,7 @@ public void implicitConversions2() {

@Test
public void implicitConversions3() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package test",
" native testSuccess()",
" public interface FoldClosure<T, Q>",
Expand Down Expand Up @@ -264,7 +264,7 @@ public void implicitConversions4() { // #490

@Test
public void implicitConversions5() { // #490
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package test",
"native testSuccess()",
"@extern native R2I(real r) returns int",
Expand Down Expand Up @@ -903,7 +903,7 @@ public void implicitsWithClosures() {
@Test
public void genericForIn() {
test().executeProg(true)
.testLua(false) // uses illegal int to T cast
.testLua(true).luaOnly(false)
.lines(
"package test",
"native testSuccess()",
Expand All @@ -930,7 +930,7 @@ public void genericForIn() {
@Test
public void genericForFrom() {
test().executeProg(true)
.testLua(false) // uses illegal int to T cast
.testLua(true).luaOnly(false)
.lines(
"package test",
"native testSuccess()",
Expand Down Expand Up @@ -1090,7 +1090,7 @@ public void strangeFoldl() { // #655

@Test
public void normalFoldlInfer() { // #657
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package test",
"native testSuccess()",
"@extern native I2S(int i) returns string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void testR2SW() {
*/
@Test
public void methodDispatchPerReceiverClassAtOneCallSite() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"native testSuccess()",
"native testFail(string msg)",
Expand Down Expand Up @@ -77,7 +77,7 @@ public void methodDispatchPerReceiverClassAtOneCallSite() {
*/
@Test
public void returnAndExitwhenLeaveTheRightStatements() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"native testSuccess()",
"native testFail(string msg)",
Expand Down Expand Up @@ -153,7 +153,7 @@ public void arrayDefaultTestFail() {

@Test
public void arrayDefault() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"native testSuccess()",
"native testFail(string msg)",
Expand All @@ -166,7 +166,7 @@ public void arrayDefault() {

@Test
public void displayNativesAcceptNullForceAndLocalPlayer() {
test().withStdLib().executeProg(true).testLua(false).lines(
test().withStdLib().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"init",
" DisplayTextToForce(null, \"force\")",
Expand Down Expand Up @@ -494,7 +494,7 @@ public void commonJConstantsCarryTheirHandles() {
/** A blizzard.j constant defined from another one, and constants whose ConvertX had no mock. */
@Test
public void derivedAndLessCommonConstants() {
test().withStdLib().executeProg(true).testLua(false).lines(
test().withStdLib().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"init",
" if bj_DEGTORAD < 0.0174 or bj_DEGTORAD > 0.0175",
Expand Down Expand Up @@ -843,7 +843,7 @@ public void groupOrderAsMeasured() {
/** `grill test` and compiletime evaluation run the IM interpreter, which reads the constants too. */
@Test
public void commonJConstantsInTestsAndCompiletime() {
test().withStdLib().executeTests(true).executeProg(true).runCompiletimeFunctions(true).testLua(false).lines(
test().withStdLib().executeTests(true).executeProg(true).runCompiletimeFunctions(true).testLua(true).luaOnly(false).lines(
"package Test",
"@compiletime function checkConstants()",
" if UNIT_TYPE_DEAD == null or UNIT_STATE_MANA == null",
Expand All @@ -863,7 +863,7 @@ public void commonJConstantsInTestsAndCompiletime() {

@Test
public void getOwningPlayerNullUnitReturnsWurstNull() {
test().withStdLib().executeProg(true).testLua(false).lines(
test().withStdLib().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"init",
" if GetOwningPlayer(null) != null",
Expand Down Expand Up @@ -959,7 +959,7 @@ public void jassRealEqualityAllowsAThousandth() {
/** 0 castTo a class is the null reference, as the stdlib's unit.toUnitIndex() relies on. */
@Test
public void castZeroToClassIsNull() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package Test",
"native testSuccess()",
"native testFail(string msg)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public void testForDownStep() {

@Test
public void testForIn() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package test",
" class IntList",
" static int array elements",
Expand Down Expand Up @@ -271,7 +271,7 @@ public void testForIn() {

@Test
public void testForFrom() {
test().executeProg(true).testLua(false).lines(
test().executeProg(true).testLua(true).luaOnly(false).lines(
"package test",
" class IntList",
" static int array elements",
Expand Down
Loading