diff options
author | Zahary Karadjov <zahary@gmail.com> | 2013-05-12 21:55:55 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2013-05-12 21:55:55 +0300 |
commit | 289c975d85a71e5ee57e2995e41d932a4f80b5c7 (patch) | |
tree | b87a6ac8198fca7b70f0b8301d38ad5fa068bada /compiler | |
parent | b3103c4657a3700e13f90fa1b4be888f023eb604 (diff) | |
download | Nim-289c975d85a71e5ee57e2995e41d932a4f80b5c7.tar.gz |
fixes #430
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sigmatch.nim | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 0c6bb26e9..3eb485f8f 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -592,14 +592,20 @@ proc typeRel(c: var TCandidate, f, a: PType): TTypeRelation = else: result = typeRel(c, x, a) # check if it fits of tyTypeDesc: - if a.kind == tyTypeDesc: - if f.sonsLen == 0: - result = isGeneric + var prev = PType(idTableGet(c.bindings, f)) + if prev == nil: + if a.kind == tyTypeDesc: + if f.sonsLen == 0: + result = isGeneric + else: + result = matchTypeClass(c, f, a.sons[0]) + if result == isGeneric: + put(c.bindings, f, a) else: - result = matchTypeClass(c, f, a.sons[0]) - if result == isGeneric: put(c.bindings, f, a) + result = isNone else: - result = isNone + InternalAssert prev.sonsLen == 1 + result = typeRel(c, prev.sons[0], a) of tyExpr, tyStmt: result = isGeneric of tyProxy: |