Skip to content

fixes #25475; incompatible types errors for array types with different index types#25505

Merged
Araq merged 3 commits intodevelfrom
pr_Kerze
Feb 13, 2026
Merged

fixes #25475; incompatible types errors for array types with different index types#25505
Araq merged 3 commits intodevelfrom
pr_Kerze

Conversation

@ringabout
Copy link
Member

@ringabout ringabout commented Feb 11, 2026

fixes #25475

var x: array[0..1, int] = [0, 1]
var y: array[4'u..5'u, int] = [0, 3]

echo x == y

sigmatch treats array compatibility by element type + length, not by the index (range) type. Perhaps backend should do the same check

Copilot AI review requested due to automatic review settings February 11, 2026 11:59
@ringabout ringabout changed the title fixes #25475; Add CoIgnoreRangeInarray flag to normalize array tyes fixes #25475; Add CoIgnoreRangeInarray flag to normalize array types Feb 11, 2026
Copy link
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

Adds a new consideration flag to signature hashing to normalize array index range handling, aiming to make array types hash more consistently (per #25475).

Changes:

  • Introduces a new ConsiderFlag value: CoIgnoreRangeInarray.
  • Updates hashType for tyRange to support hashing range length (instead of exact bounds) when the new flag is present.
  • Updates hashType for tyArray to pass the new flag when hashing the array index type.

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

@ringabout ringabout marked this pull request as draft February 11, 2026 12:06
@ringabout ringabout changed the title fixes #25475; Add CoIgnoreRangeInarray flag to normalize array types fixes #25475; incompatible types errors for array types with different index types Feb 12, 2026
@ringabout ringabout marked this pull request as ready for review February 12, 2026 11:58
@Araq Araq merged commit 97fed25 into devel Feb 13, 2026
21 checks passed
@Araq Araq deleted the pr_Kerze branch February 13, 2026 21:59
@github-actions
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 97fed25

Hint: mm: orc; opt: speed; options: -d:release
189511 lines; 11.434s; 801.566MiB peakmem

narimiran pushed a commit that referenced this pull request Feb 16, 2026
…t index types (#25505)

fixes #25475

```nim
var x: array[0..1, int] = [0, 1]
var y: array[4'u..5'u, int] = [0, 3]

echo x == y
```

sigmatch treats array compatibility by element type + length, not by the
index (range) type. Perhaps backend should do the same check

(cherry picked from commit 97fed25)
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.

Invalid C code generation with seq[array[...]]

2 participants

Comments