From 05cbbac4e56b07b902b21f1e9a3f270f450b5d04 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Fri, 2 Jan 2015 23:57:55 +0200 Subject: support for static params in the user defined type classes --- compiler/semcall.nim | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'compiler/semcall.nim') diff --git a/compiler/semcall.nim b/compiler/semcall.nim index 3971b8ff5..a712cc195 100644 --- a/compiler/semcall.nim +++ b/compiler/semcall.nim @@ -277,16 +277,14 @@ proc semResolvedCall(c: PContext, n: PNode, x: TCandidate): PNode = styleCheckUse(n.sons[0].info, finalCallee) if finalCallee.ast == nil: internalError(n.info, "calleeSym.ast is nil") # XXX: remove this check! + if x.hasFauxMatch: + result = x.call + result.sons[0] = newSymNode(finalCallee, result.sons[0].info) + if containsGenericType(result.typ) or x.fauxMatch == tyUnknown: + result.typ = newTypeS(x.fauxMatch, c) + return if finalCallee.ast.sons[genericParamsPos].kind != nkEmpty: - # a generic proc! - if not x.proxyMatch: - finalCallee = generateInstance(c, x.calleeSym, x.bindings, n.info) - else: - result = x.call - result.sons[0] = newSymNode(finalCallee, result.sons[0].info) - result.typ = finalCallee.typ.sons[0] - if containsGenericType(result.typ): result.typ = errorType(c) - return + finalCallee = generateInstance(c, x.calleeSym, x.bindings, n.info) result = x.call instGenericConvertersSons(c, result, x) result.sons[0] = newSymNode(finalCallee, result.sons[0].info) -- cgit 1.4.1-2-gfad0