| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail20609.d(26): Error: none of the overloads of `this` are callable using argument types `(int)` |
| 5 |
fail_compilation/fail20609.d(23): Candidate is: `fail20609.Foo.this(string[] args)` |
| 6 |
fail_compilation/fail20609.d(27): Error: none of the overloads of `this` are callable using argument types `(int)` |
| 7 |
fail_compilation/fail20609.d(22): Candidates are: `fail20609.Foo.this(Object __param_0)` |
| 8 |
fail_compilation/fail20609.d(23): `fail20609.Foo.this(string[] args)` |
| 9 |
fail_compilation/fail20609.d(37): Error: none of the overloads of `this` are callable using argument types `(int)` |
| 10 |
fail_compilation/fail20609.d(37): All possible candidates are marked as `deprecated` or `@disable` |
| 11 |
fail_compilation/fail20609.d(43): Error: undefined identifier `deprecatedTypo_` |
| 12 |
fail_compilation/fail20609.d(44): Error: undefined identifier `deprecatedTypo_`, did you mean function `deprecatedTypo`? |
| 13 |
fail_compilation/fail20609.d(45): Error: undefined identifier `disabledTypo_` |
| 14 |
--- |
| 15 |
*/ |
| 16 |
|
| 17 |
// Only show `this(string[])` in non-deprecated context. |
| 18 |
// Show both `this(string[])` and ` this(Object)` in deprecated context. |
| 19 |
struct Foo |
| 20 |
{ |
| 21 |
@disable this(); |
| 22 |
deprecated this(Object) {} |
| 23 |
this(string[] args) {} |
| 24 |
} |
| 25 |
|
| 26 |
void test1() { auto f = Foo(42); } |
| 27 |
deprecated void test2() { auto f = Foo(42); } |
| 28 |
|
| 29 |
// Make sure we do not show a message promising candidates, |
| 30 |
// then no candidates in the special case where nothing |
| 31 |
// would be usable |
| 32 |
struct WhoDoesThat |
| 33 |
{ |
| 34 |
@disable this(); |
| 35 |
deprecated this(Object) {} |
| 36 |
} |
| 37 |
void test3() { auto f = WhoDoesThat(42); } |
| 38 |
|
| 39 |
// Make sure we don't suggest disabled or deprecated functions |
| 40 |
deprecated void deprecatedTypo () {} |
| 41 |
@disable void disabledTypo () {} |
| 42 |
|
| 43 |
void test4 () { deprecatedTypo_("42"); } |
| 44 |
deprecated void test5 () { deprecatedTypo_("42"); } |
| 45 |
void test6 () { disabledTypo_("42"); } |