diff options
Diffstat (limited to 'compiler/sigmatch.nim')
-rw-r--r-- | compiler/sigmatch.nim | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 0c6456e68..92971b072 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -624,6 +624,9 @@ proc procTypeRel(c: var TCandidate, f, a: PType): TTypeRelation = if f.len != a.len: return result = isEqual # start with maximum; also correct for no # params at all + + if f.flags * {tfIterator} != a.flags * {tfIterator}: + return isNone template checkParam(f, a) = result = minRel(result, procParamTypeRel(c, f, a)) @@ -1636,13 +1639,19 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, of tyBuiltInTypeClass: considerPreviousT: - let targetKind = f[0].kind + let target = f[0] + let targetKind = target.kind let effectiveArgType = a.skipTypes({tyRange, tyGenericInst, tyBuiltInTypeClass, tyAlias, tySink, tyOwned}) - let typeClassMatches = targetKind == effectiveArgType.kind and - not effectiveArgType.isEmptyContainer - if typeClassMatches or - (targetKind in {tyProc, tyPointer} and effectiveArgType.kind == tyNil): + if targetKind == effectiveArgType.kind: + if effectiveArgType.isEmptyContainer: + return isNone + if targetKind == tyProc: + if target.flags * {tfIterator} != effectiveArgType.flags * {tfIterator}: + return isNone + if tfExplicitCallConv in target.flags and + target.callConv != effectiveArgType.callConv: + return isNone put(c, f, a) return isGeneric else: |