R7b batch 4 #2 (docs/design/lua-luau-kernel-port-checklist.md is the authoritative quirk list). ONE walker for both dialects (ccpp precedent) — the differences are exactly four: luau's type_definition aliases, the `export `-slice isExported hook, the return-type signature suffix, and the grammar handle. Grammar prep is kernel-side only, no wasm change: lua is the SECOND vendored-grammar-C language (the vendored wasm is the v0.4.1 tag, a revision not on crates.io — tag artifacts compiled via build.rs, shas pinned); luau is a plain crate pin =1.2.0 whose tarball is sha-identical to the tag (the swift tag≠crate divergence does not recur). Grammar-parity rows replace the bump gate entirely. Preserved bug-for-bug (all probe-pinned): the require/visitNode-hook ASYMMETRIES (top-level requires — including inside top-level if/for/while — mint import nodes while the identical body-level statement emits `calls "require"`; top-level `local x = foo()` initializers are invisible while global `x = foo()` calls emit), the BFS string-win inside require args (`require(script:WaitForChild("Kid"))` → import Kid) and Roblox instance paths, receiver-QN methods (`M.sub.deep::chained`, `_G::installed`, stack-QN nested globals like `render::leakedGlobal`), the raw-text callee world (colon forms with `self` never stripped, bracket callees, newline-glued chains byte-verbatim, the `(handler)` paren-conversion), LUA_SPEC function-as-value capture with the `M.cb = cb` param-storage skip and first-occurrence dedupe, LuaDoc `---` keeping a leading `- ` plus `--!strict` joining docstring chains (block-comment docstrings keep interior CRLF bytes), variable nodes at the IDENTIFIER with positional value pairing, duplicate same-(kind,name,line) ids, and the lua↔luau isExported wire divergence (lua functions: flag absent; luau functions: present-false; methods: absent in both; variables: present-false in both; `export type`: true). Gates: parity sweeps first-run 0-diff on kong/lazy.nvim/lua-resty-core (lua) + lune/Fusion (luau) — 1,734 clean files byte-parity, deferrals 1/0/0/3/8 matching the survey's both-arm predictions exactly (kong's 1 = a deliberately invalid fixture; luau's = grammar-inherent generic type packs and default type params); full-init dumps byte-identical kernel-vs-wasm ×4 (kong 157,650 dump lines); kernel-lua-parity suite (both torture fixtures + in-memory CRLF variants + glue-chain, duplicate-id, and cross-dialect defer pins + kernel-arm wire-flag pins); full suite 2,647 green ×2 with CODEGRAPH_KERNEL_EXPECT=1. DEFAULT_ROUTED += lua, luau (18 langs). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
62 lines
1.2 KiB
Luau
62 lines
1.2 KiB
Luau
--!strict
|
|
-- header comment for torture.luau
|
|
local core = require("app.core")
|
|
local Signal = require(script.Parent.Signal)
|
|
|
|
-- doc for Point
|
|
type Point = { x: number, y: number }
|
|
--- doc for exported Handler
|
|
export type Handler = (msg: string) -> ()
|
|
export type Generic<T> = { value: T }
|
|
type FromTypeof = typeof(require(script.Parent.Config))
|
|
|
|
--- doc for typedTop
|
|
function typedTop(a: number, b: string?): boolean
|
|
return a > 0 and b ~= nil
|
|
end
|
|
|
|
function genericFn<T>(v: T): T
|
|
return v
|
|
end
|
|
|
|
function multiRet(): (number, string)
|
|
return 1, "x"
|
|
end
|
|
|
|
local function emptyOneLiner() end
|
|
|
|
local M = {}
|
|
local CONST_N = 7
|
|
|
|
function M.make(n: number): Point
|
|
return { x = n, y = n }
|
|
end
|
|
|
|
function M:update(p: Point, cb: Handler)
|
|
type BodyLocal = { z: number }
|
|
local Config = require(script.Parent.Config)
|
|
local msg = `point {p.x} of {Config.total()}`
|
|
cb(msg)
|
|
self:redraw()
|
|
self.canvas.flush()
|
|
M.make(3)
|
|
local v = if p.x > 0 then bump() else drop()
|
|
v += grow()
|
|
local narrowed = p :: any
|
|
for i = 1, 10 do
|
|
if i % 2 == 0 then
|
|
continue
|
|
end
|
|
end
|
|
end
|
|
|
|
M.registry = { on_make = M.make, plain = typedTop }
|
|
|
|
typedTop(1, "s")
|
|
M.make(2)
|
|
M:update({ x = 1, y = 2 }, print)
|
|
|
|
local préfixe = "café"
|
|
function after_unicode() end
|
|
return M
|