Skip to content

Commit

Permalink
Catch Luau RecursionLimitException until it stops leaking
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyMorganz committed Jul 15, 2023
1 parent e348d50 commit b7f740a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed semantic tokens segfault crash on some tables
- Fixed duplicate definitions showing in the Go To Definition page
- Fixed some syntax highlighting inconsistencies
- Added a temporary fix to "RecursionLimitException" exceptions leaking to the public interface.

## [1.22.0] - 2023-06-30

Expand Down
13 changes: 12 additions & 1 deletion src/Workspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,18 @@ bool WorkspaceFolder::isDefinitionFile(const std::filesystem::path& path, const
// NOTE: use `frontend.parse` if you do not care about typechecking
Luau::CheckResult WorkspaceFolder::checkSimple(const Luau::ModuleName& moduleName, bool runLintChecks)
{
return frontend.check(moduleName, Luau::FrontendOptions{/* retainFullTypeGraphs: */ false, /* forAutocomplete: */ false, runLintChecks});
try
{
return frontend.check(moduleName, Luau::FrontendOptions{/* retainFullTypeGraphs: */ false, /* forAutocomplete: */ false, runLintChecks});
}
catch (Luau::InternalCompilerError& err)
{
// TODO: RecursionLimitException is leaking out of frontend.check
// https://github.com/Roblox/luau/issues/975
// Remove this try-catch block once the above issue is fixed
client->sendLogMessage(lsp::MessageType::Warning, "Luau InternalCompilerError caught in " + moduleName + ": " + err.what());
return Luau::CheckResult{};
}
}

// Runs `Frontend::check` on the module whilst retaining the type graph.
Expand Down

0 comments on commit b7f740a

Please sign in to comment.