summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-07-01 08:06:58 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-07-01 08:06:58 +0200
commit584d7783180d0b2417b0a2ffb955877c39660273 (patch)
treec6fd39b5a2d9fc3faf784b07b3141db35166ed18
parenteec239e851c6be4922d9746d07a20c37c0157442 (diff)
downloadNim-584d7783180d0b2417b0a2ffb955877c39660273.tar.gz
Fix use of custom pragmas in generic procs (#8165)
Fixes #7626
-rw-r--r--compiler/semgnrc.nim3
-rw-r--r--tests/pragmas/tcustom_pragma.nim10
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