[Luau] Requiring modules with errors causes weird error highlights in scripts

Hi all, I’m loving the new Luau type checker. I was in the process of migrating some scripts code to Luau type checking and came across a very weird bug. There were some orange highlights that behaved strangely. I’ll call this code from the script the “main” script


This error is actually from a module script that is required in the main script couple lines above. Removing the require() or fixing the error in the module script removes this weird error highlight from the main script.
What’s even spookier is that this error’s position is based on how many characters you have in the script. Adding whitespace, comments, or longer variable names moves the error as you type.

I’ve attached two scripts to help reproduce this issue. Filled with filler text because I didn’t feel like sharing a core component of a game i’m working on.
Place the “test” module script in game.ReplicatedStorage.Modules.Temp, and the main script will require it.
The errors appear on lines 76-82 and 98-100 in the main script.

main script.lua (2.6 KB)
test.lua (2.8 KB)

1 Like