Skip to content

Generic pattern skips non-letter characters at the end #3014

Closed
@TIMONz1535

Description

@TIMONz1535

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?

Annotations

Expected Behaviour

feature #2484

Generic pattern can't recognize non-letter characters after `T` for example `T`.Base or `T`*

There is my example

---@generic T
---@param t MainContainer.`T`
---@return T
local function SubContainerClass(t) end

local mainContainerBase = SubContainerClass('Base')           -- MainContainer.Base
local mainContainerSubExtra = SubContainerClass('SubExtra')   -- MainContainer.SubExtra

---@generic T
---@param t `T`.Base
---@return T
local function ContainerClassBase(t) end

local mainContainerBase = ContainerClassBase('MainContainer') -- BUG: MainContainer instead of MainContainer.Base
local extraContainerBase = ContainerClassBase('ExtraContainer') -- BUG: ExtraContainer instead of ExtraContainer.Base

---@generic T
---@param t `T`*
---@return T
local function GetObjectPointer(t) end

---@generic T
---@param t `T`2
---@return T
local function GetObject2(t) end

local entityPointer = GetObjectPointer('Entity') -- BUG: Entity instead of Entity*
local entity2 = GetObject2('Entity') -- BUG: Entity instead of Entity2

Actual Behaviour

{8C546A71-BC93-4889-B8CB-60BBA6C99E42}

---@generic T
---@param t1 A.`T`Base -- works
---@param t2 A`T`Base -- works
---@param t3 A*`T` -- works
---@param t4 A`T`.Base -- nothing after `T`
---@param t5 `T`.Base -- nothing after `T`
---@param t6 `T`Base -- nothing after `T`
---@param t7 A*`T`* -- nothing after `T`
---@param t8 `T`* -- nothing after `T`
---@param t9 A`T`2 -- seems to be broken at all
---@return T
local function Test(t1,t2,t3,t4,t5,t6,t7,t8,t9) end

Reproduction steps

  1. Create generic patter with *, . or number after `T`
  2. There is no more definition after `T`

Additional Notes

Your class name can be very weird, but it works.
class

I just want to use pointer Class*

Log File

No response

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