Intellisense treats an instance variable as a function, if a function is declared below the variable

If you have a variable containing an instance, and a second variable containing a child instance of the first variable, declaring a function below the second variable will cause intellisense to refer to the function’s signature instead, and the second variable will not be autocompleted when between the declaration of it, and the declaration of the function.

I would expect that variable2 is treated as an instance, and will autocomplete between declaration of it, and the declaration of myFunction.

NOTE: This only happens if the function is the first code below the declaration of the second variable. If there is a comment or other code, it will behave normally. If you prefix the function with the local keyword, it also behaves normally.

Steps to reproduce:

  1. Declare variable variable1 that is pointing to an instance.
  2. Declare a variable variable2 that is pointing to a child instance of variable1.
  3. Declare a function myFunction that can be anything, but it must be the first code below variable2
  4. Type variable2 below myFunction, and it will autocomplete as a function.
  5. Type variable2 between its declaration, and myFunction. It will not autocomplete.

This bug happens 100% of the time in every server and local script.

I am running Windows 10, Version 1809 (Build 17763.973) but this has been happening for a bit prior to this version.

Repro place:
IntellisenseBug.rbxl (17.6 KB)

4 Likes