Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 1 addition & 2 deletions lute/cli/src/tc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ declare fs: {
close: (file) -> (),
read: (file) -> string,
write: (file, string) -> (),
readfiletostring : (string) -> string,
writestringtofile : (string, string) -> (),
-- is this right? I feel like we want a promise type here
readasync : (string) -> string,
}
Expand Down Expand Up @@ -186,6 +184,7 @@ int typecheck(const std::vector<std::string>& sourceFilesInput, LuteReporter& re
LuteFileResolver fileResolver;
Luau::LuteConfigResolver configResolver(mode);
Luau::Frontend frontend(&fileResolver, &configResolver, frontendOptions);
frontend.setLuauSolverMode(Luau::SolverMode::New);

Luau::registerBuiltinGlobals(frontend, frontend.globals);
Luau::LoadDefinitionFileResult loadResult =
Expand Down
35 changes: 35 additions & 0 deletions tests/cli/check.test.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
local fs = require("@std/fs")
local path = require("@std/path")
local process = require("@std/process")
local system = require("@std/system")
local test = require("@std/test")

local lutePath = path.format(process.execpath())
local tmpDir = system.tmpdir()

test.suite("lute check", function(suite)
suite:case("uses new solver", function(assert)
local testFilePath = path.format(path.join(tmpDir, "check_new_solver.luau"))
fs.writestringtofile(
testFilePath,
[[
function add(a,b)
return a + b
end

local vec2 = {}

function vec2.new(x, y)
return setmetatable({x = x or 0, y = y or 0}, {__add = function(v1, v2) return {x = v1.x + v2.x, y = v1.y + v2.y} end})
end

add(1,1)
add(vec2.new(0, 0), vec2.new(1,1))
]]
)

local result = process.run({ lutePath, "check", testFilePath })
assert.eq(result.exitcode, 0)
fs.remove(testFilePath)
end)
end)