* Make explicit {.nimcall.} a seperate calling convention
* Add testcase for #5688
* Fix bootstrapping
* Remove little lies :)
* Use typeflag instead
This commit is contained in:
commit
813f16a2a3
16 changed files with 67 additions and 25 deletions
|
|
@ -1,5 +1,5 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got <proc (x: int){.gcsafe, locks: 0.}>"
|
||||
errormsg: "type mismatch: got <proc (x: int){.nimcall, gcsafe, locks: 0.}>"
|
||||
line: 12
|
||||
"""
|
||||
|
||||
|
|
|
|||
9
tests/closure/tinvalidclosure4.nim
Normal file
9
tests/closure/tinvalidclosure4.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
discard """
|
||||
errormsg: "illegal capture 'v'"
|
||||
line: 7
|
||||
"""
|
||||
|
||||
proc outer(v: int) =
|
||||
proc b {.nimcall.} = echo v
|
||||
b()
|
||||
outer(5)
|
||||
10
tests/closure/tinvalidclosure5.nim
Normal file
10
tests/closure/tinvalidclosure5.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
discard """
|
||||
errormsg: "type mismatch: got <proc (){.closure, gcsafe, locks: 0.}> but expected 'A = proc (){.nimcall.}'"
|
||||
line: 9
|
||||
"""
|
||||
|
||||
type A = proc() {.nimcall.}
|
||||
proc main =
|
||||
let b = 1
|
||||
let a: A = proc() = echo b
|
||||
|
||||
|
|
@ -33,6 +33,7 @@ py
|
|||
py
|
||||
px
|
||||
6
|
||||
proc (){.closure, gcsafe, locks: 0.}
|
||||
'''
|
||||
"""
|
||||
|
||||
|
|
@ -177,3 +178,19 @@ block tclosure2:
|
|||
|
||||
|
||||
outer2()
|
||||
|
||||
# bug #5688
|
||||
|
||||
import typetraits
|
||||
|
||||
proc myDiscard[T](a: T) = discard
|
||||
|
||||
proc foo() =
|
||||
let a = 5
|
||||
let f = (proc() =
|
||||
myDiscard (proc() = echo a)
|
||||
)
|
||||
echo name(type(f))
|
||||
|
||||
foo()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue