Skip to content

Commit 1834d62

Browse files
authored
Merge pull request #7947 from JinShil/fix_18505
Fix Issue 18505 - delete deprecation message is misleading
2 parents 75b460e + db25160 commit 1834d62

8 files changed

Lines changed: 41 additions & 41 deletions

File tree

src/dmd/parse.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7756,7 +7756,7 @@ final class Parser(AST) : Lexer
77567756
// 1. Deprecation for 1 year
77577757
// 2. Error for 1 year
77587758
// 3. Removal, "delete" can be used for other identities
7759-
deprecation("The `delete` keyword has been deprecated. Use `object.destroy()` instead.");
7759+
deprecation("The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.");
77607760
e = new AST.DeleteExp(loc, e, false);
77617761
break;
77627762

test/compilable/vgc1.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
/*
55
TEST_OUTPUT:
66
---
7-
compilable/vgc1.d(93): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
8-
compilable/vgc1.d(94): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
9-
compilable/vgc1.d(95): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
7+
compilable/vgc1.d(93): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
8+
compilable/vgc1.d(94): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
9+
compilable/vgc1.d(95): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
1010
---
1111
*/
1212

test/fail_compilation/fail14486.d

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,36 @@
33
/*
44
TEST_OUTPUT:
55
---
6-
fail_compilation/fail14486.d(81): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
7-
fail_compilation/fail14486.d(82): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
8-
fail_compilation/fail14486.d(83): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
9-
fail_compilation/fail14486.d(84): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
10-
fail_compilation/fail14486.d(85): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
11-
fail_compilation/fail14486.d(99): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
12-
fail_compilation/fail14486.d(100): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
13-
fail_compilation/fail14486.d(101): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
14-
fail_compilation/fail14486.d(102): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
15-
fail_compilation/fail14486.d(103): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
16-
fail_compilation/fail14486.d(123): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
17-
fail_compilation/fail14486.d(124): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
18-
fail_compilation/fail14486.d(125): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
19-
fail_compilation/fail14486.d(126): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
20-
fail_compilation/fail14486.d(127): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
21-
fail_compilation/fail14486.d(141): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
22-
fail_compilation/fail14486.d(142): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
23-
fail_compilation/fail14486.d(143): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
24-
fail_compilation/fail14486.d(144): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
25-
fail_compilation/fail14486.d(145): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
26-
fail_compilation/fail14486.d(164): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
27-
fail_compilation/fail14486.d(165): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
28-
fail_compilation/fail14486.d(166): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
29-
fail_compilation/fail14486.d(167): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
30-
fail_compilation/fail14486.d(168): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
31-
fail_compilation/fail14486.d(181): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
32-
fail_compilation/fail14486.d(182): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
33-
fail_compilation/fail14486.d(183): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
34-
fail_compilation/fail14486.d(184): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
35-
fail_compilation/fail14486.d(185): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
6+
fail_compilation/fail14486.d(81): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
7+
fail_compilation/fail14486.d(82): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
8+
fail_compilation/fail14486.d(83): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
9+
fail_compilation/fail14486.d(84): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
10+
fail_compilation/fail14486.d(85): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
11+
fail_compilation/fail14486.d(99): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
12+
fail_compilation/fail14486.d(100): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
13+
fail_compilation/fail14486.d(101): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
14+
fail_compilation/fail14486.d(102): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
15+
fail_compilation/fail14486.d(103): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
16+
fail_compilation/fail14486.d(123): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
17+
fail_compilation/fail14486.d(124): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
18+
fail_compilation/fail14486.d(125): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
19+
fail_compilation/fail14486.d(126): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
20+
fail_compilation/fail14486.d(127): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
21+
fail_compilation/fail14486.d(141): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
22+
fail_compilation/fail14486.d(142): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
23+
fail_compilation/fail14486.d(143): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
24+
fail_compilation/fail14486.d(144): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
25+
fail_compilation/fail14486.d(145): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
26+
fail_compilation/fail14486.d(164): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
27+
fail_compilation/fail14486.d(165): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
28+
fail_compilation/fail14486.d(166): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
29+
fail_compilation/fail14486.d(167): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
30+
fail_compilation/fail14486.d(168): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
31+
fail_compilation/fail14486.d(181): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
32+
fail_compilation/fail14486.d(182): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
33+
fail_compilation/fail14486.d(183): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
34+
fail_compilation/fail14486.d(184): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
35+
fail_compilation/fail14486.d(185): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
3636
---
3737
*/
3838

test/fail_compilation/fail2361.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
TEST_OUTPUT:
33
---
4-
fail_compilation/fail2361.d(14): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
4+
fail_compilation/fail2361.d(14): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
55
fail_compilation/fail2361.d(14): Error: cannot modify `immutable` expression `c`
66
---
77
*/

test/fail_compilation/fail_arrayop2.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
TEST_OUTPUT:
55
---
6-
fail_compilation/fail_arrayop2.d(281): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
6+
fail_compilation/fail_arrayop2.d(281): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
77
fail_compilation/fail_arrayop2.d(13): Error: array operation `[1, 2, 3] - [1, 2, 3]` without destination memory not allowed
88
fail_compilation/fail_arrayop2.d(16): Error: invalid array operation `"a" - "b"` (possible missing [])
99
---

test/fail_compilation/faildeleteaa.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
TEST_OUTPUT:
33
---
4-
fail_compilation/faildeleteaa.d(12): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
4+
fail_compilation/faildeleteaa.d(12): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
55
fail_compilation/faildeleteaa.d(12): Error: cannot delete type `int`
66
---
77
*/

test/fail_compilation/nogc1.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
/*
55
TEST_OUTPUT:
66
---
7-
fail_compilation/nogc1.d(91): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
8-
fail_compilation/nogc1.d(92): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
9-
fail_compilation/nogc1.d(93): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
7+
fail_compilation/nogc1.d(91): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
8+
fail_compilation/nogc1.d(92): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
9+
fail_compilation/nogc1.d(93): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
1010
---
1111
*/
1212

test/fail_compilation/test16195.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* TEST_OUTPUT:
33
---
4-
fail_compilation/test16195.d(14): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` instead.
4+
fail_compilation/test16195.d(14): Deprecation: The `delete` keyword has been deprecated. Use `object.destroy()` (and `core.memory.GC.free()` if applicable) instead.
55
fail_compilation/test16195.d(14): Error: `delete p` is not `@safe` but is used in `@safe` function `test`
66
---
77
*/

0 commit comments

Comments
 (0)