tcon1.nim 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ## Test Invocation `con`text in various situations
  2. ## various of this proc are used as the basis for these tests
  3. proc test(s: string; a: int) = discard
  4. ## This overload should be used to ensure the lower airity `test` doesn't match
  5. proc test(s: string; a: string, b: int) = discard
  6. ## similar signature but different name to ensure `con` doesn't get greedy
  7. proc testB(a, b: string) = discard
  8. # with a param already specified
  9. test("hello here", #[!]#)
  10. # as first param
  11. testB(#[!]#
  12. # dot expressions
  13. "from behind".test(#[!]#
  14. # two params matched, so disqualify the lower airity `test`
  15. # TODO: this doesn't work, because dot exprs, overloads, etc aren't currently
  16. # handled by suggest.suggestCall. sigmatch.partialMatch by way of
  17. # sigmatch.matchesAux. Doesn't use the operand before the dot as part of
  18. # the formal parameters. Changing this is tricky because it's used by
  19. # the proper compilation sem pass and that's a big change all in one go.
  20. "and again".test("more", #[!]#
  21. discard """
  22. $nimsuggest --tester $file
  23. >con $1
  24. con;;skProc;;tcon1.test;;proc (s: string, a: int);;$file;;4;;5;;"";;100
  25. con;;skProc;;tcon1.test;;proc (s: string, a: string, b: int);;$file;;7;;5;;"";;100
  26. >con $2
  27. con;;skProc;;tcon1.testB;;proc (a: string, b: string);;$file;;10;;5;;"";;100
  28. >con $3
  29. con;;skProc;;tcon1.test;;proc (s: string, a: string, b: int);;$file;;7;;5;;"";;100
  30. con;;skProc;;tcon1.test;;proc (s: string, a: int);;$file;;4;;5;;"";;100
  31. >con $4
  32. con;;skProc;;tcon1.test;;proc (s: string, a: int);;$file;;4;;5;;"";;100
  33. con;;skProc;;tcon1.test;;proc (s: string, a: string, b: int);;$file;;7;;5;;"";;100
  34. """