Skip to content

refactor generic#1081

Open
xuhuanzy wants to merge 10 commits into
EmmyLuaLs:mainfrom
xuhuanzy:refactor-generic
Open

refactor generic#1081
xuhuanzy wants to merge 10 commits into
EmmyLuaLs:mainfrom
xuhuanzy:refactor-generic

Conversation

@xuhuanzy
Copy link
Copy Markdown
Member

@xuhuanzy xuhuanzy commented May 14, 2026

  1. std.ConstTpl语义扩展为 TS 的 const, 即在泛型推断中固定所有字面量而不只限于 boolean/string/int
  2. 现在泛型推断中字面量会根据上下文自动宽化
  3. @type在绑定泛型时会尽量展开为最佳形状
            ---@alias Extract<T, U> T extends U and T or never
            ---@alias KeepA<T> Extract<T, "a">
            ---@alias ForwardConditional<T> KeepA<T>

            ---@generic T
            local function f()
                ---@type ForwardConditional<T>
                local cond -- is `Extract<T,"a">`
            end

@xuhuanzy xuhuanzy changed the title refactor(generic): Add more precise type widening refactor generic May 14, 2026
@github-actions

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

@xuhuanzy
Copy link
Copy Markdown
Member Author

/gemini review

gemini-code-assist[bot]

This comment was marked as resolved.

@xuhuanzy
Copy link
Copy Markdown
Member Author

/gemini review

gemini-code-assist[bot]

This comment was marked as resolved.

@xuhuanzy
Copy link
Copy Markdown
Member Author

/gemini review

gemini-code-assist[bot]

This comment was marked as resolved.

@xuhuanzy xuhuanzy force-pushed the refactor-generic branch from 9ddc9a4 to 9a4ec66 Compare May 22, 2026 17:13
@xuhuanzy xuhuanzy marked this pull request as ready for review May 22, 2026 17:14
@xuhuanzy
Copy link
Copy Markdown
Member Author

/gemini review

gemini-code-assist[bot]

This comment was marked as resolved.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant