This commit is contained in:
Araq 2015-02-26 00:11:21 +01:00
commit 9053799bf5
5 changed files with 47 additions and 16 deletions

View file

@ -95,15 +95,6 @@ proc inferWithMetatype(c: PContext, formal: PType,
var commonTypeBegin = PType(kind: tyExpr)
proc isEmptyContainer(t: PType): bool =
case t.kind
of tyExpr, tyNil: result = true
of tyArray, tyArrayConstr: result = t.sons[1].kind == tyEmpty
of tySet, tySequence, tyOpenArray, tyVarargs:
result = t.sons[0].kind == tyEmpty
of tyGenericInst: result = isEmptyContainer(t.lastSon)
else: result = false
proc commonType*(x, y: PType): PType =
# new type relation that is used for array constructors,
# if expressions, etc.: