Skip to content

Nested property type lost when accessed from reference #1613

Open
@lunarwtr

Description

@lunarwtr

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Type Checking

Expected Behaviour

	local A = {}

	---@class B
	---@overload fun(): B
	local B = {}

	---@class C
	---@overload fun(): C
	local C = {}

	A.property1 = B()

	A.property1.property2 = C()

	local refToB = A.property1

	local refToC = refToB.property2

while the local refToB is correctly of type B, it no longer is aware of property2.

image

expected behavior would be that it is aware of the properties assigned to the instance.

Actual Behaviour

presence of property is lost in the "instance" of object B (not definition).

Reproduction steps

  1. Go to '...'
  2. Click '...'
  3. See error '...'

Additional Notes

No response

Log File

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    as designedFunctioning as intended, will not be modified

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions