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