Skip to content

Unexpected typechecking (with classes only?) #3262

@Rathoz

Description

@Rathoz

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

MacOS

What is the issue affecting?

Type Checking

Expected Behaviour

---@param a string
---@return string
local function expandHeader(a) return a end

---@class baz
---@field header string?

---@type baz
local foo = {}
local bar = foo.header
expandHeader(foo.header) -- param-type-mismatch
expandHeader(bar) -- param-type-mismatch

Actual Behaviour

---@param a string
---@return string
local function expandHeader(a) return a end

---@class baz
---@field header string?

---@type baz
local foo = {}
local bar = foo.header
expandHeader(foo.header) -- NO WARNING
expandHeader(bar) -- param-type-mismatch

Reproduction steps

See actual behavior

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