mused3.nim 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #[
  2. ran from trunner
  3. ]#
  4. # line 10
  5. when defined case1:
  6. from mused3a import nil
  7. from mused3b import nil
  8. mused3a.fn1()
  9. when defined case2:
  10. from mused3a as m1 import nil
  11. m1.fn1()
  12. when defined case3:
  13. from mused3a import fn1
  14. fn1()
  15. when defined case4:
  16. from mused3a as m1 import fn1
  17. m1.fn1()
  18. when defined case5:
  19. import mused3a as m1
  20. fn1()
  21. when defined case6:
  22. import mused3a except nonexistent
  23. fn1()
  24. when defined case7:
  25. import mused3a
  26. mused3a.fn1()
  27. when defined case8:
  28. # re-export test
  29. import mused3a except nonexistent
  30. gn1()
  31. when defined case9:
  32. # re-export test
  33. import mused3a
  34. gn1()
  35. when defined case10:
  36. #[
  37. edge case which happens a lot in compiler code:
  38. don't report UnusedImport for mused3b here even though it works without `import mused3b`,
  39. because `a.b0.f0` is accessible from both mused3a and mused3b (fields are given implicit access)
  40. ]#
  41. import mused3a
  42. import mused3b
  43. var a: Bar
  44. discard a.b0.f0
  45. when false:
  46. when defined case11:
  47. #[
  48. xxx minor bug: this should give:
  49. Warning: imported and not used: 'm2' [UnusedImport]
  50. but doesn't, because currently implementation in `markOwnerModuleAsUsed`
  51. only looks at `fn1`, not fully qualified call `m1.fn1()
  52. ]#
  53. from mused3a as m1 import nil
  54. from mused3a as m2 import nil
  55. m1.fn1()
  56. when defined case12:
  57. import mused3a
  58. import mused3a
  59. fn1()