* Make explicit {.nimcall.} a seperate calling convention

* Add testcase for #5688

* Fix bootstrapping

* Remove little lies :)

* Use typeflag instead
This commit is contained in:
Andreas Rumpf 2020-08-11 14:50:46 +02:00 • committed by GitHub
commit 813f16a2a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 67 additions and 25 deletions

View file

@ -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
"""

View file

@ -0,0 +1,9 @@
discard """
errormsg: "illegal capture 'v'"
line: 7
"""
proc outer(v: int) =
proc b {.nimcall.} = echo v
b()
outer(5)

View 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

View file

@ -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()