fixes #25617; handle backend type aliasing in procParamTypeRel#25692
Open
fixes #25617; handle backend type aliasing in procParamTypeRel#25692
Conversation
Contributor
There was a problem hiding this comment.
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
procParamTypeRelwhen the semantic relation isisEqual. - Treat
tyInferredsimilarly totyAliasduring structural equality setup to avoid false mismatches. - Add a regression test covering
uintvscsize_tproc assignment failures and extend concept coverage forcint.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #25617
This pull request introduces a stricter check for parameter type relations in the
procParamTypeRelprocedure. 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: InprocParamTypeRel, added a check to ensure that if two types are considered equal (isEqual), they must also have the same backend type (usingsameBackendTypePickyAliases). If not, the result is set toisNone, preventing false positives when type aliases differ.