fix #20829 Regression in int64 type matching since (#21019)

fix #20829 Regression in int64 type matching
This commit is contained in:
Bung 2022-12-06 14:44:54 +08:00 • committed by GitHub
commit 5d469686b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -395,9 +395,9 @@ proc handleRange(c: PContext, f, a: PType, min, max: TTypeKind): TTypeRelation =
result = isIntConv
elif a.kind == tyUInt and nf == c.config.targetSizeUnsignedToKind:
result = isIntConv
elif f.kind == tyInt and na in {tyInt8 .. c.config.targetSizeSignedToKind}:
elif f.kind == tyInt and na in {tyInt8 .. pred(c.config.targetSizeSignedToKind)}:
result = isIntConv
elif f.kind == tyUInt and na in {tyUInt8 .. c.config.targetSizeUnsignedToKind}:
elif f.kind == tyUInt and na in {tyUInt8 .. pred(c.config.targetSizeUnsignedToKind)}:
result = isIntConv
elif k >= min and k <= max:
result = isConvertible
@ -2116,6 +2116,8 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
case r
of isConvertible:
if f.skipTypes({tyRange}).kind in {tyInt, tyUInt}:
inc(m.convMatches)
inc(m.convMatches)
result = implicitConv(nkHiddenStdConv, f, arg, m, c)
of isIntConv: