Using dot operators doesn't throw type checker error while bracket operators do

Reproduction Steps

  1. Create any Luau script/localscript.
  2. Paste the following code snippet:
type R6Character =  Model & {
	Humanoid: Humanoid,
	Head: Part & {
		Face: Decal
	},
}

local function Test(char: R6Character)
	print(
		char.Head.Face,
		char.Head["Face"]
	)
end
  1. Look in the Script Analysis window or check for underlined parts.

image


Expected Behavior

Both print arguments should not cause the Luau typechecker to throw an error.


Actual Behavior

Luau typechecker throws an error.

image


Issue Area: Studio (Built-In Script Editor)
Issue Type: Luau typechecker / Script Analysis
Impact: Low
Frequency: Always
Date First Experienced: 2022-08-06 4:06 PM (GMT-5)


Operating System: Windows 11 Pro
Roblox Studio: Version 0.538.0.5380364 (64bit)

Thank you for the report, we plan to fix this issue soon.

There are additional cases with intersections and unions that we want to work better with . and [], but those improvements will come at a later time.

2 Likes