mt1.nim 461 B

123456789101112131415161718192021222324
  1. import ./m1 {.all.} as m
  2. doAssert foo1 == 2
  3. doAssert m.foo1 == 2
  4. doAssert m.m3h2 == 2
  5. doAssert m3h2 == 2
  6. doAssert m.foo1Aux == 2
  7. doAssert m.m3p1 == 2
  8. ## field access
  9. import std/importutils
  10. privateAccess(Foo5)
  11. var x = Foo5(z1: "foo", z2: m.kg1)
  12. doAssert x.z1 == "foo"
  13. var f0: Foo5
  14. f0.z3 = 3
  15. doAssert f0.z3 == 3
  16. var f = initFoo5(z3=3)
  17. doAssert f.z3 == 3
  18. doAssert z3(f) == 30
  19. doAssert m.z3(f) == 30
  20. doAssert not compiles(mt1.`z3`(f)) # z3 is an imported symbol