mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-29 16:25:14 +00:00
fixes #22861; Error: internal error: invalid kind for lastOrd(tyGenericParam)
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -1425,13 +1425,15 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||
if a.kind == tyArray:
|
||||
var fRange = f.indexType
|
||||
var aRange = a.indexType
|
||||
var indexRel = isEqual
|
||||
if fRange.kind in {tyGenericParam, tyAnything}:
|
||||
var prev = lookup(c.bindings, fRange)
|
||||
if prev == nil:
|
||||
if typeRel(c, fRange, aRange) == isNone:
|
||||
indexRel = typeRel(c, fRange, aRange)
|
||||
if indexRel == isNone:
|
||||
return isNone
|
||||
put(c, fRange, a.indexType)
|
||||
fRange = a
|
||||
fRange = aRange
|
||||
else:
|
||||
fRange = prev
|
||||
let ff = f[1].skipTypes({tyTypeDesc})
|
||||
@@ -1442,6 +1444,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
||||
result = isGeneric
|
||||
else:
|
||||
result = typeRel(c, ff, aa, flags)
|
||||
if indexRel == isGeneric and result > isGeneric:
|
||||
result = isGeneric
|
||||
if result < isGeneric:
|
||||
if nimEnableCovariance and
|
||||
trNoCovariance notin flags and
|
||||
|
||||
@@ -252,3 +252,9 @@ block: # issue #9381
|
||||
|
||||
var x: GenericObj[int]
|
||||
static: doAssert evalCount == 1
|
||||
|
||||
block: # bug #22861
|
||||
proc fromHex[N](A: type array[N, int]) = discard
|
||||
proc fromHex (T: typedesc[array[1, int]]) = discard
|
||||
fromHex(array[1, int])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user