Skip to content

Commit

Permalink
account for mArrGet/mArrPut not matching generic params
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Oct 4, 2024
1 parent 4071fe9 commit 35c41b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/sigmatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,9 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
result = arg
elif skipTypes(arg.typ, abstractVar-{tyTypeDesc}).kind == tyTuple or cmpInheritancePenalty(oldInheritancePenalty, m.inheritancePenalty) > 0:
result = implicitConv(nkHiddenSubConv, f, arg, m, c)
elif arg.typ.isEmptyContainer or arg.typ.isIntLit:
elif arg.typ.isEmptyContainer or
# mArrGet/mArrPut short circuit and don't bind generic params
(arg.typ.isIntLit and m.magic notin {mArrGet, mArrPut}):
result = arg.copyTree
result.typ = getInstantiatedType(c, arg, m, f)
else:
Expand Down
6 changes: 6 additions & 0 deletions tests/js/tint64litgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ block: # issue #24233, modified

let x: int64 = 456
foo(x, bar)

block:
proc foo[I: Ordinal](x: I) = discard
foo(123)
let x = [0, 1, 2]
discard x[0]

0 comments on commit 35c41b0

Please sign in to comment.