Fix Cyclic Module Dependency Error appearing inside of task.defer()

This provided code inside a task.defer() and is still telling me im recursively requiring the module. This also happens in the new luau type solver beta.

This error just simply isnt accurate due to how task.defer() works.

image

Betas Enabled
  • Next Gen Studio Preview
  • Revamped Asset Manager
  • Next Gen Explorer
  • Avatar Joint Upgrade
  • CreateAssetAsync Lua API
  • Dragger QoL Improvements
  • Haptic Effects
  • Import Queue
  • Incremental typechecking and autocompletion in studio (issue still happens without this enabled)
  • LIVE Animation Creator
  • Multilayer Wrap Fix
  • New Studio Camera Controls
  • Script Sync [Early Preview]
  • Scripts Are Non-Strict By Default
  • Studio solid modeling improvements
  • Texture Generator
  • UIDragDetectors
  • Unified Lighting

System Info can be found in the private content

Expected behavior

The underline doesnt appear and my type checking continues to work as normal instead of setting the variable to the any type

A private message is associated with this bug report

1 Like

In 1951, Henry Gordon Rice published his dissertation that proved an important theorem, now called Rice’s theorem, about computation that generalizes the Halting Problem: all non-trivial semantic properties of programs are uncomputable. That is, if we want to know any property of a program’s behavior at runtime that is not always true or always false (this last bit is the meaning of “non-trivial”), we cannot ever compute the answer. In essence, programs cannot determine the answer to any question about another program’s runtime behavior without running it.

Since this is the case, all static analysis of programs, including all type systems, are built as a syntactic approximation of the runtime behavior of the program. If this example is indeed noncyclic (a claim that I can’t verify since you did not provide the source of the parent), that determination cannot be made based on the syntax of the program. All the static analysis can see is that there is a dependency between the two scripts, and so it surfaces the error. We cannot do any better than that without some kind of static model of the behavior of the task scheduler, and even then, we wouldn’t be able to tell that task was not replaced by something with different behavior.

3 Likes