Skip to content

Instantly share code, notes, and snippets.

@flaviut
Last active August 29, 2015 14:04
Show Gist options
  • Save flaviut/aa0dda27a97eb89e03e0 to your computer and use it in GitHub Desktop.
Save flaviut/aa0dda27a97eb89e03e0 to your computer and use it in GitHub Desktop.
Allow type constructors
diff --git a/compiler/ast.nim b/compiler/ast.nim
index bdb8d1c..b0d869c 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -847,7 +847,7 @@ type
const
OverloadableSyms* = {skProc, skMethod, skIterator, skClosureIterator,
- skConverter, skModule, skTemplate, skMacro}
+ skConverter, skModule, skTemplate, skMacro, skType}
GenericTypes*: TTypeKinds = {tyGenericInvokation, tyGenericBody,
tyGenericParam}
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index ee8b1cc..b5fc9fb 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -199,12 +199,12 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym): PNode =
result = newSymNodeTypeDesc(s, n.info)
of skParam:
result = n
- of skType:
+ else: result = newSymNode(s, n.info)
+ if s.kind == skType:
if (s.typ != nil) and (s.typ.kind != tyGenericParam):
result = newSymNodeTypeDesc(s, n.info)
else:
result = n
- else: result = newSymNode(s, n.info)
proc semRoutineInTemplName(c: var TemplCtx, n: PNode): PNode =
result = n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment