tctypes.nim 825 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. discard """
  2. targets: "c cpp"
  3. matrix: "--gc:refc; --gc:arc"
  4. """
  5. # bug #7308
  6. proc foo(x: seq[int32]) =
  7. var y = newSeq[cint](1)
  8. proc bar =
  9. var t = newSeq[int32](1)
  10. foo(t)
  11. bar()
  12. # bug #16246
  13. proc testWeirdTypeAliases() =
  14. var values = newSeq[cuint](8)
  15. # var values: seq[cuint] does not produce codegen error
  16. var drawCb = proc(): seq[uint32] =
  17. result = newSeq[uint32](10)
  18. testWeirdTypeAliases()
  19. block: # bug #11797
  20. block:
  21. type cdouble2 = cdouble
  22. type Foo1 = seq[cdouble]
  23. type Foo2 = seq[cdouble2]
  24. static: doAssert Foo1 is Foo2
  25. var a1: Foo1
  26. var a2: Foo2
  27. doAssert a1 == @[]
  28. doAssert a2 == @[]
  29. block:
  30. proc foo[T: int|cint](fun: proc(): T) = discard
  31. proc foo1(): cint = 1
  32. proc foo3(): int32 = 2
  33. foo(proc(): cint = foo1())
  34. foo(proc(): int32 = foo3())