Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test-cases for #12576 and #12523 #15085

Merged
merged 2 commits into from Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions tests/iter/titer_issues.nim
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ end
9014
9016
9018
@[1, 2]
@[1, 2, 3]
'''
"""

Expand Down Expand Up @@ -191,7 +193,7 @@ block t3499_keepstate:
break

# bug #3499 last snippet fixed
# bug 705 last snippet fixed
# bug #705 last snippet fixed



Expand Down Expand Up @@ -225,7 +227,7 @@ block t2023_objiter:


block:
# issue #13739
# bug #13739
iterator myIter(arg: openarray[int]): int =
var tmp = 0
let len = arg.len
Expand All @@ -240,3 +242,12 @@ block:
echo x

someProc()

block:
# bug #12576
iterator ff(sq: varargs[seq[int]]): int =
for x in sq:
echo x

for x in ff(@[1, 2], @[1, 2, 3]):
echo x
25 changes: 23 additions & 2 deletions tests/pragmas/tcustom_pragma.nim
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ ProcDef
static: assert bar("x") == "x"

#------------------------------------------------------
# issue #13909
# bug #13909

template dependency*(id: string, weight = 0.0) {.pragma.}

Expand All @@ -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
result = obj

# bug 12523
template myCustomPragma {.pragma.}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the "customPragma" pragma name because it conflicts with the imported "custompragma" module symbol, not sure if that's a bug or not


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)