fix compilation regression in alea
This commit is contained in:
parent
dfbafff2e7
commit
4da8536701
4 changed files with 37 additions and 12 deletions
33
tests/concepts/tconceptinclosure.nim
Normal file
33
tests/concepts/tconceptinclosure.nim
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
discard """
|
||||
output: "10\n20"
|
||||
"""
|
||||
|
||||
type
|
||||
FonConcept = concept x
|
||||
x.x is int
|
||||
|
||||
Implementation = object
|
||||
x: int
|
||||
|
||||
Closure = object
|
||||
f: proc()
|
||||
|
||||
proc f1(x: FonConcept): Closure =
|
||||
result.f = proc () =
|
||||
echo x.x
|
||||
|
||||
proc f2(x: FonConcept): Closure =
|
||||
result.f = proc () =
|
||||
echo x.x
|
||||
|
||||
let x = Implementation(x: 10)
|
||||
let y = Implementation(x: 20)
|
||||
|
||||
let a = x.f1
|
||||
let b = x.f2
|
||||
let c = x.f1
|
||||
let d = y.f2
|
||||
|
||||
a.f()
|
||||
d.f()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue