From 109bc3f595a868097347e547bd0b472e927301c7 Mon Sep 17 00:00:00 2001 From: Varun Saini <61795485+vrn-sn@users.noreply.github.com> Date: Sat, 12 Apr 2025 19:18:00 -0700 Subject: [PATCH] Do not store file extension in REPL's module chunknames --- CLI/src/Repl.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CLI/src/Repl.cpp b/CLI/src/Repl.cpp index 56d9cf8b..9fb1221f 100644 --- a/CLI/src/Repl.cpp +++ b/CLI/src/Repl.cpp @@ -581,7 +581,14 @@ static bool runFile(const char* name, lua_State* GL, bool repl) // new thread needs to have the globals sandboxed luaL_sandboxthread(L); - std::string chunkname = "@" + std::string(name); + // ignore file extension when storing module's chunkname + std::string chunkname = "@"; + std::string_view nameView = name; + if (size_t dotPos = nameView.find_last_of('.'); dotPos != std::string_view::npos) + { + nameView.remove_suffix(nameView.size() - dotPos); + } + chunkname += nameView; std::string bytecode = Luau::compile(*source, copts()); int status = 0;