diff options
author | Araq <rumpf_a@web.de> | 2015-03-25 14:50:08 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-03-25 14:50:08 +0100 |
commit | e680e43fc2885c3af611c99c47ba5f2ac098b33e (patch) | |
tree | 41105cb4f5e10a548bae73ba7a921315bbe2b5a7 /compiler | |
parent | d5fc62022acf95e8b50286fc2c4db427c7521a61 (diff) | |
download | Nim-e680e43fc2885c3af611c99c47ba5f2ac098b33e.tar.gz |
fixes #2405
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/parser.nim | 6 | ||||
-rw-r--r-- | compiler/semtypes.nim | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index 1c8231453..d1aa2d8e3 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -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: diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 4de705704..a19cc65c3 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -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 |