diff options
author | Alexander Ivanov <alehander42@gmail.com> | 2019-04-05 17:43:36 +0300 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-04-05 16:43:36 +0200 |
commit | f101f09256d5d788a404c1d0a2301ed7853b0f14 (patch) | |
tree | 609b913b6b9cab692112dcf4c80d5259b3cd579c /tests/pragmas | |
parent | 3a5a0f6d46fa0b43ec223d60b2e0f600305eb5f8 (diff) | |
download | Nim-f101f09256d5d788a404c1d0a2301ed7853b0f14.tar.gz |
Fix astdef typ deref (#10245)
Diffstat (limited to 'tests/pragmas')
-rw-r--r-- | tests/pragmas/tcustom_pragma.nim | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim index 9f2fc024b..719af4d50 100644 --- a/tests/pragmas/tcustom_pragma.nim +++ b/tests/pragmas/tcustom_pragma.nim @@ -1,3 +1,5 @@ +{.experimental: "notnil".} + import macros block: @@ -11,8 +13,10 @@ block: block: template myAttr(a: string) {.pragma.} - type MyObj = object - myField1, myField2 {.myAttr: "hi".}: int + type + MyObj = object + myField1, myField2 {.myAttr: "hi".}: int + var o: MyObj static: assert o.myField2.hasCustomPragma(myAttr) @@ -206,11 +210,16 @@ block: template myAttr2(x: int) {.pragma.} template myAttr3(x: string) {.pragma.} + type + MyObj2 = ref object + MyObjNotNil = MyObj2 not nil + let a {.myAttr,myAttr2(2),myAttr3:"test".}: int = 0 let b {.myAttr,myAttr2(2),myAttr3:"test".} = 0 var x {.myAttr,myAttr2(2),myAttr3:"test".}: int = 0 var y {.myAttr,myAttr2(2),myAttr3:"test".}: int var z {.myAttr,myAttr2(2),myAttr3:"test".} = 0 + var z2 {.myAttr.}: MyObjNotNil template check(s: untyped) = doAssert s.hasCustomPragma(myAttr) |