diff options
author | Danil Yarantsev <tiberiumk12@gmail.com> | 2020-07-27 14:01:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-27 13:01:50 +0200 |
commit | 4c43915b5911b4b1d7cf35e3ba156fabde58ed84 (patch) | |
tree | 4e06ba4bf4f13b9882078aeb0e6cf57e259a2248 /tests/pragmas | |
parent | c292c57e48c719875a37fa50d2ca6a3d3639ae2e (diff) | |
download | Nim-4c43915b5911b4b1d7cf35e3ba156fabde58ed84.tar.gz |
Add test-cases for #12576 and #12523 (#15085)
* Add a test-case for #12576 * Add a test-case for #12523
Diffstat (limited to 'tests/pragmas')
-rw-r--r-- | tests/pragmas/tcustom_pragma.nim | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim index b306045e0..756396529 100644 --- a/tests/pragmas/tcustom_pragma.nim +++ b/tests/pragmas/tcustom_pragma.nim @@ -336,7 +336,7 @@ ProcDef static: assert bar("x") == "x" #------------------------------------------------------ -# issue #13909 +# bug #13909 template dependency*(id: string, weight = 0.0) {.pragma.} @@ -345,4 +345,25 @@ type provider*: proc(obj: string): pointer {.dependency("Data/" & obj, 16.1), noSideEffect.} proc myproc(obj: string): string {.dependency("Data/" & obj, 16.1).} = - result = obj \ No newline at end of file + result = obj + +# bug 12523 +template myCustomPragma {.pragma.} + +type + RefType = ref object + field {.myCustomPragma.}: int + + ObjType = object + field {.myCustomPragma.}: int + RefType2 = ref ObjType + +block: + let x = RefType() + for fieldName, fieldSym in fieldPairs(x[]): + doAssert hasCustomPragma(fieldSym, myCustomPragma) + +block: + let x = RefType2() + for fieldName, fieldSym in fieldPairs(x[]): + doAssert hasCustomPragma(fieldSym, myCustomPragma) |