This commit is contained in:
ringabout
2026-02-12 17:25:32 +08:00
parent 9aceeffe56
commit 5bb846cf9e
2 changed files with 19 additions and 5 deletions

View File

@@ -41,7 +41,7 @@ type
CoType
CoOwnerSig
CoIgnoreRange
CoIgnoreRangeInarray
CoIgnoreRangeInArray
CoConsiderOwned
CoDistinct
CoHashTypeInsideNode
@@ -221,14 +221,14 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]; conf: Confi
else:
for a in t.kids: c.hashType a, flags+{CoIgnoreRange}, conf
of tyRange:
if {CoIgnoreRange, CoIgnoreRangeInarray} * flags == {}:
if {CoIgnoreRange, CoIgnoreRangeInArray} * flags == {}:
c &= char(t.kind)
c.hashTree(t.n, {}, conf)
c.hashType(t.elementType, flags, conf)
elif CoIgnoreRangeInarray in flags:
elif CoIgnoreRangeInArray in flags:
# include only the length of the range (not its specific bounds)
c &= char(t.kind)
let l = lastOrd(conf, t) - firstOrd(conf, t) + 1
let l = lengthOrd(conf, t)
lowlevel l
else:
c.hashType(t.elementType, flags, conf)
@@ -261,7 +261,7 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]; conf: Confi
if tfVarargs in t.flags: c &= ".varargs"
of tyArray:
c &= char(t.kind)
c.hashType(t.indexType, flags-{CoIgnoreRange}+{CoIgnoreRangeInarray}, conf)
c.hashType(t.indexType, flags-{CoIgnoreRange}+{CoIgnoreRangeInArray}, conf)
c.hashType(t.elementType, flags-{CoIgnoreRange}, conf)
else:
c &= char(t.kind)

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]