Skip to content

fixes #25617; handle backend type aliasing in procParamTypeRel#25692

Open
ringabout wants to merge 5 commits intodevelfrom
pr_aliases
Open

fixes #25617; handle backend type aliasing in procParamTypeRel#25692
ringabout wants to merge 5 commits intodevelfrom
pr_aliases

Conversation

@ringabout
Copy link
Copy Markdown
Member

fixes #25617

This pull request introduces a stricter check for parameter type relations in the procParamTypeRel procedure. Specifically, it ensures that two types are not only structurally equal but also have the same backend type, taking type aliases into account.

Type relation checks:

  • compiler/sigmatch.nim: In procParamTypeRel, added a check to ensure that if two types are considered equal (isEqual), they must also have the same backend type (using sameBackendTypePickyAliases). If not, the result is set to isNone, preventing false positives when type aliases differ.

@ringabout ringabout marked this pull request as ready for review April 3, 2026 08:35
Copilot AI review requested due to automatic review settings April 3, 2026 08:35
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

This PR fixes #25617 by tightening proc-parameter type relation checks so that “semantically equal” parameter types must also agree at the backend/ABI level (including alias distinctions), preventing Nim from accepting assignments that later fail during C compilation.

Changes:

  • Add an additional backend-type compatibility check in procParamTypeRel when the semantic relation is isEqual.
  • Treat tyInferred similarly to tyAlias during structural equality setup to avoid false mismatches.
  • Add a regression test covering uint vs csize_t proc assignment failures and extend concept coverage for cint.

Reviewed changes

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

File Description
compiler/sigmatch.nim Rejects proc-param matches that are semantically equal but backend-incompatible (alias-aware).
compiler/types.nim Adjusts type equality preprocessing to skip tyInferred alongside tyAlias.
tests/proc/tbackendtypealias.nim New regression test ensuring uint vs csize_t proc assignment is rejected at Nim level.
tests/concepts/tconcepts_issues.nim Adds concept-related coverage to ensure common cint matching continues to work.

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

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.

incompatible function pointer types C error with uint vs csize_t

2 participants