summary refs log tree commit diff stats
path: root/compiler/evalffi.nim
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2018-06-21 22:21:24 +0200
committerLemonBoy <thatlemon@gmail.com>2018-06-22 13:09:33 +0200
commitaf66258dca695d932e76ea31bdee2b2f185139cb (patch)
treedcefe96abe0cde0c24913474be47fb6ad7170d60 /compiler/evalffi.nim
parent0da87939d136f90eeb0ec613ff484b8f2992e7b0 (diff)
downloadNim-af66258dca695d932e76ea31bdee2b2f185139cb.tar.gz
Discriminate gensym'd type names in sigHash
The root cause of #7905 lies in the codegen phase. The two template
instantiations generate two different MyType types with different
members but same t.sym.name leading the caching mechanism to confuse
the two.

Fixes #7905
Diffstat (limited to 'compiler/evalffi.nim')
0 files changed, 0 insertions, 0 deletions
7 17:11:22 +0100 committer Andreas Rumpf <rumpf_a@web.de> 2019-03-07 17:11:22 +0100 make tests green again' href='/ahoang/Nim/commit/tests/parallel/tdeepcopy2.nim?h=devel&id=5c201791b31d02ebb979408c954104d8edb087ba'>5c201791b ^
1088814e5 ^














830e0c000 ^



1088814e5 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
           
                     
             
                       


                       








                 
                                                














                                                                           



                          

      
discard """
  matrix: "--mm:refc"
  output: '''
called deepCopy for int
called deepCopy for int
done999 999
'''
"""

import threadpool


type
  Bar[T] = object
    x: T

proc `=deepCopy`[T](b: ref Bar[T]): ref Bar[T] =
  result.new
  result.x = b.x
  when T is int:
    echo "called deepCopy for int"
  else:
    echo "called deepCopy for something else"

proc foo(b: ref Bar[int]): int = 999

# test that the disjoint checker deals with 'a = spawn f(); g = spawn f()':

proc main =
  var dummy: ref Bar[int]
  new(dummy)
  dummy.x = 44
  #parallel:
  let f = spawn foo(dummy)
  let b = spawn foo(dummy)
  echo "done", ^f, " ", ^b

main()