diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-06-12 11:50:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 11:50:40 +0200 |
commit | aaceec074456dcbbd6409faf07146a584b7439eb (patch) | |
tree | 015d1fdbb690ed97e7ba4843f7962a98ed148695 /compiler/sigmatch.nim | |
parent | 1c58f31a71d2fb8c8569a6ceb6fffc4778d1c7ab (diff) | |
parent | 44d82d94927424ce643aecba5231adb698bf3965 (diff) | |
download | Nim-aaceec074456dcbbd6409faf07146a584b7439eb.tar.gz |
Merge pull request #7981 from cooldome/Fix_-7980
Fixes 7980
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r-- | compiler/sigmatch.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index cf5e3dccb..cd8d2f45d 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -2366,14 +2366,18 @@ proc matches*(c: PContext, n, nOrig: PNode, m: var TCandidate) = for t in m.inferredTypes: if t.sonsLen > 1: t.sons.setLen 1 -proc argtypeMatches*(c: PContext, f, a: PType): bool = +proc argtypeMatches*(c: PContext, f, a: PType, fromHlo = false): bool = var m: TCandidate initCandidate(c, m, f) let res = paramTypesMatch(m, f, a, c.graph.emptyNode, nil) #instantiateGenericConverters(c, res, m) # XXX this is used by patterns.nim too; I think it's better to not # instantiate generic converters for that - result = res != nil + if not fromHlo: + res != nil + else: + # pattern templates do not allow for conversions except from int literal + res != nil and m.convMatches == 0 and m.intConvMatches in [0, 256] proc instTypeBoundOp*(c: PContext; dc: PSym; t: PType; info: TLineInfo; op: TTypeAttachedOp; col: int): PSym {.procvar.} = |