fixes #25475; incompatible types errors for array types with different 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
This commit is contained in:
ringabout
2026-02-14 05:59:21 +08:00
committed by GitHub
parent 937e647f4f
commit 97fed258ed
2 changed files with 25 additions and 3 deletions

View File

@@ -605,3 +605,17 @@ block t18643:
except IndexDefect:
caught = true
doAssert caught, "IndexDefect not caught!"
# bug #25475
block:
type N = object
b: seq[array[1'u, int]]
doAssert N(b: @[[0]]) == N(b: @[[0]])
block:
var x: array[5..6, int] = [0, 1]
var y: array[1..2, int] = [0, 1]
doAssert x == y # compiles
doAssert @[x] == @[y]