disabled non-documented overloading rule for templates and macros

This commit is contained in:
Andreas Rumpf 2018-02-02 11:00:42 +01:00
commit 1b22a3b346
3 changed files with 21 additions and 14 deletions

View file

@ -1859,19 +1859,22 @@ proc paramTypesMatchAux(m: var TCandidate, f, a: PType,
var r = typeRel(m, f, a) var r = typeRel(m, f, a)
if r != isNone and m.calleeSym != nil and when false:
m.calleeSym.kind in {skMacro, skTemplate}: # This special typing rule for macros and templates is not documented
# XXX: duplicating this is ugly, but we cannot (!) move this # anywhere and breaks symmetry.
# directly into typeRel using return-like templates if r != isNone and m.calleeSym != nil and
incMatches(m, r) m.calleeSym.kind in {skMacro, skTemplate}:
if f.kind == tyStmt: # XXX: duplicating this is ugly, but we cannot (!) move this
return arg # directly into typeRel using return-like templates
elif f.kind == tyTypeDesc: incMatches(m, r)
return arg if f.kind == tyStmt:
elif f.kind == tyStatic: return arg
return arg.typ.n elif f.kind == tyTypeDesc:
else: return arg
return argSemantized # argOrig elif f.kind == tyStatic:
return arg.typ.n
else:
return argSemantized # argOrig
# If r == isBothMetaConvertible then we rerun typeRel. # If r == isBothMetaConvertible then we rerun typeRel.
# bothMetaCounter is for safety to avoid any infinite loop, # bothMetaCounter is for safety to avoid any infinite loop,

View file

@ -67,7 +67,7 @@ proc innerHash(state: var Sha1State, w: var Sha1Buffer) =
var round = 0 var round = 0
template rot(value, bits: uint32): uint32 = template rot(value, bits: uint32): uint32 =
(value shl bits) or (value shr (32 - bits)) (value shl bits) or (value shr (32u32 - bits))
template sha1(fun, val: uint32) = template sha1(fun, val: uint32) =
let t = rot(a, 5) + fun + e + val + w[round] let t = rot(a, 5) + fun + e + val + w[round]

View file

@ -1,6 +1,10 @@
discard """ discard """
disabled: "true"
""" """
# disabled: relied on undocumented overloading rules. Too much work
# to make this sane.
import macros, strUtils import macros, strUtils
proc symToIdent(x: NimNode): NimNode = proc symToIdent(x: NimNode): NimNode =