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