From 584d7783180d0b2417b0a2ffb955877c39660273 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Sun, 1 Jul 2018 08:06:58 +0200 Subject: [PATCH] Fix use of custom pragmas in generic procs (#8165) Fixes #7626 --- compiler/semgnrc.nim | 3 ++- tests/pragmas/tcustom_pragma.nim | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim index 0218096d6..e3c750f5b 100644 --- a/compiler/semgnrc.nim +++ b/compiler/semgnrc.nim @@ -54,7 +54,8 @@ template macroToExpand(s): untyped = s.kind in {skMacro, skTemplate} and (s.typ.len == 1 or sfAllUntyped in s.flags) template macroToExpandSym(s): untyped = - s.kind in {skMacro, skTemplate} and (s.typ.len == 1) and not fromDotExpr + sfCustomPragma notin s.flags and s.kind in {skMacro, skTemplate} and + (s.typ.len == 1) and not fromDotExpr template isMixedIn(sym): bool = let s = sym diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim index 33a4a7e65..cd1edccf6 100644 --- a/tests/pragmas/tcustom_pragma.nim +++ b/tests/pragmas/tcustom_pragma.nim @@ -137,4 +137,12 @@ block: static: assert hasIntSerKey assert strSerKey == "string" - assert nestedItemDefVal == "Nimmers of the world, unite!" \ No newline at end of file + assert nestedItemDefVal == "Nimmers of the world, unite!" + +block: + template simpleAttr {.pragma.} + + type Annotated {.simpleAttr.} = object + + proc generic_proc[T]() = + assert Annotated.hasCustomPragma(simpleAttr) \ No newline at end of file