Skip to content

fixes #22861; Error: internal error: invalid kind for lastOrd(tyGenericParam)#25776

Open
ringabout wants to merge 4 commits intodevelfrom
pr_full_of_oneself
Open

fixes #22861; Error: internal error: invalid kind for lastOrd(tyGenericParam)#25776
ringabout wants to merge 4 commits intodevelfrom
pr_full_of_oneself

Conversation

@ringabout
Copy link
Copy Markdown
Member

fixes #22861

…icParam)

Co-authored-by: Copilot <copilot@github.com>
Copilot AI review requested due to automatic review settings April 28, 2026 12:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Nim compiler crash #22861 triggered by overload resolution involving a generic array parameter and a concrete typedesc[array[...]] overload.

Changes:

  • Adjusts typeRel’s tyArray matching to correctly track the relation result for the array index type and to bind/use the actual index type (aRange) instead of the whole array type.
  • Ensures an index-type match that is only isGeneric can’t incorrectly “upgrade” the overall array match to isEqual.
  • Adds a regression test covering the reported overloaded generic fromHex scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
compiler/sigmatch.nim Fixes array index-type matching/binding in typeRel to prevent mis-ranking/incorrect handling that led to the internal error.
tests/generics/tgenerics_various.nim Adds a compile regression case for #22861 (overloaded generic procs with array + typedesc[array[...]]).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ringabout and others added 3 commits April 29, 2026 18:15
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
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.

Error: internal error: invalid kind for lastOrd(tyGenericParam) with overloaded generic procs

2 participants