Skip to content

Unexpected typechecking (with classes only?) #3262

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions