This commit is contained in:
Araq
2015-03-25 14:50:08 +01:00
parent d5fc62022a
commit e680e43fc2
2 changed files with 6 additions and 2 deletions

View File

@@ -1075,9 +1075,11 @@ proc primary(p: var TParser, mode: TPrimaryMode): PNode =
getTok(p)
of tkGeneric, tkConcept:
if mode == pmTypeDef:
if p.tok.tokType == tkGeneric:
parMessage(p, warnDeprecated, "use 'concept' instead; 'generic'")
let wasGeneric = p.tok.tokType == tkGeneric
result = parseTypeClass(p)
# hack so that it's remembered and can be marked as deprecated in
# sem'check:
if wasGeneric: result.flags.incl nfBase2
else:
parMessage(p, errInvalidToken, p.tok)
of tkStatic:

View File

@@ -1090,6 +1090,8 @@ proc freshType(res, prev: PType): PType {.inline.} =
proc semTypeClass(c: PContext, n: PNode, prev: PType): PType =
# if n.sonsLen == 0: return newConstraint(c, tyTypeClass)
if nfBase2 in n.flags:
message(n.info, warnDeprecated, "use 'concept' instead; 'generic'")
result = newOrPrevType(tyUserTypeClass, prev, c)
result.n = n