implemented return type inference
Other fixes: * bind once is now the default for type classes as documented in the manual * fixes an issue in template overloading (erroneous ambiguity when different typedesc params were used)
This commit is contained in:
parent
b28fcdfa93
commit
7e44015491
9 changed files with 104 additions and 36 deletions
|
|
@ -282,7 +282,12 @@ proc matchTypeClass(c: var TCandidate, typeClass, t: PType): TTypeRelation =
|
|||
# if the loop finished without returning, either all constraints matched
|
||||
# or none of them matched.
|
||||
result = if tfAny in typeClass.flags: isNone else: isGeneric
|
||||
|
||||
|
||||
proc matchTypeClass*(typeClass, typ: PType): bool =
|
||||
var c: TCandidate
|
||||
InitCandidate(c, typeClass)
|
||||
result = matchTypeClass(c, typeClass, typ) == isGeneric
|
||||
|
||||
proc procTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
|
||||
proc inconsistentVarTypes(f, a: PType): bool {.inline.} =
|
||||
result = f.kind != a.kind and (f.kind == tyVar or a.kind == tyVar)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue