Clarify how module paths are evaluated

This commit is contained in:
Daniel P H Fox 2023-08-19 19:55:39 +01:00 committed by GitHub
parent dd93d75706
commit c976ab2eb6
Signed by: DevComp
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,7 +46,7 @@ local foo = doSomething(require("foo")) -- ok
local bar = doSomething(import from "foo") -- not ok local bar = doSomething(import from "foo") -- not ok
``` ```
Since this statement will need to be evaluated for the purposes of type autocomplete/inference/etc, the argument *must* be statically evaluatable (as is currently done to provide typechecking for `require()`): The module path is evaluated at runtime, but is required to be analysable for the purposes of static type checking. Specifically, imports are *not* hardcoded at compile time, because especially in Roblox-like environments, the same code may execute from different locations.
```Lua ```Lua
import from "foo" -- ok import from "foo" -- ok