Skip to content

Commit

Permalink
give int literals matched type on generic match
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Oct 4, 2024
1 parent d6a71a1 commit 4071fe9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/sigmatch.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,7 @@ 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:
elif arg.typ.isEmptyContainer or arg.typ.isIntLit:
result = arg.copyTree
result.typ = getInstantiatedType(c, arg, m, f)
else:
Expand Down
24 changes: 24 additions & 0 deletions tests/js/tint64litgen.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
discard """
matrix: "--jsbigint64:on; --jsbigint64:off"
"""

block: # issue #24233
proc foo[T: SomeInteger](a, b: T) =
let x = a div b

const bar = 123

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

block: # issue #24233, modified
proc f(a, b: int64) =
let x = a div b

proc foo[T: SomeInteger](a, b: T) =
f(a, b)

const bar = 123

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

0 comments on commit 4071fe9

Please sign in to comment.