fixes for the new overloading resolution

This commit is contained in:
Araq 2013-03-03 16:35:19 +01:00
commit 4b0cdc6db7
4 changed files with 14 additions and 21 deletions

View file

@ -30,6 +30,11 @@ proc getIdentNode(n: PNode): PNode =
else:
illFormedAst(n)
result = n
proc newSymNodeTypeDesc(s: PSym; info: TLineInfo): PNode =
result = newSymNode(s, info)
result.typ = newType(tyTypeDesc, s.owner)
result.typ.addSonSkipIntLit(s.typ)
proc semGenericStmt(c: PContext, n: PNode, flags: TSemGenericFlags,
ctx: var TIntSet): PNode
@ -63,12 +68,12 @@ proc semGenericStmtSymbol(c: PContext, n: PNode, s: PSym): PNode =
else:
result = symChoice(c, n, s, scOpen)
of skGenericParam:
result = newSymNode(s, n.info)
result = newSymNodeTypeDesc(s, n.info)
of skParam:
result = n
of skType:
if (s.typ != nil) and (s.typ.kind != tyGenericParam):
result = newSymNode(s, n.info)
result = newSymNodeTypeDesc(s, n.info)
else:
result = n
else: result = newSymNode(s, n.info)
@ -156,13 +161,13 @@ proc semGenericStmt(c: PContext, n: PNode,
of skProc, skMethod, skIterator, skConverter:
result.sons[0] = symChoice(c, n.sons[0], s, scOption)
first = 1
of skGenericParam:
result.sons[0] = newSymNode(s, n.sons[0].info)
of skGenericParam:
result.sons[0] = newSymNodeTypeDesc(s, n.sons[0].info)
first = 1
of skType:
# bad hack for generics:
if (s.typ != nil) and (s.typ.kind != tyGenericParam):
result.sons[0] = newSymNode(s, n.sons[0].info)
result.sons[0] = newSymNodeTypeDesc(s, n.sons[0].info)
first = 1
else:
result.sons[0] = newSymNode(s, n.sons[0].info)