Don't expose internal names in errors (#20803)

This commit is contained in:
Dennis 2025-01-30 14:49:50 +01:00 committed by GitHub
parent a05ac96299
commit bfbac11136
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 76 additions and 60 deletions

View file

@ -23,7 +23,7 @@
"endline": 9,
"kind": "static constructor",
"line": 9,
"name": "_staticCtor_L9_C1",
"name": "static this",
"protection": "public",
"storageClass": [
"static"
@ -49,7 +49,7 @@
"endline": 11,
"kind": "static destructor",
"line": 11,
"name": "_staticDtor_L11_C1",
"name": "static ~this",
"protection": "public",
"storageClass": [
"static"
@ -77,7 +77,7 @@
"endline": 16,
"kind": "static constructor",
"line": 16,
"name": "_staticCtor_L16_C5",
"name": "static this",
"storageClass": [
"static"
]
@ -99,7 +99,7 @@
"endline": 18,
"kind": "static destructor",
"line": 18,
"name": "_staticDtor_L18_C5",
"name": "static ~this",
"storageClass": [
"static"
]
@ -147,7 +147,7 @@
"endline": 26,
"kind": "static constructor",
"line": 26,
"name": "_staticCtor_L26_C5",
"name": "static this",
"protection": "public",
"storageClass": [
"static"
@ -173,7 +173,7 @@
"endline": 28,
"kind": "static destructor",
"line": 28,
"name": "_staticDtor_L28_C5",
"name": "static ~this",
"protection": "public",
"storageClass": [
"static"
@ -1186,4 +1186,4 @@
],
"name": "json"
}
]
]

View file

@ -1,12 +1,12 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail10964.d(28): Error: function `fail10964.S.__postblit` is not `nothrow`
fail_compilation/fail10964.d(29): Error: function `fail10964.S.__postblit` is not `nothrow`
fail_compilation/fail10964.d(30): Error: function `fail10964.S.__postblit` is not `nothrow`
fail_compilation/fail10964.d(33): Error: function `fail10964.S.__postblit` is not `nothrow`
fail_compilation/fail10964.d(34): Error: function `fail10964.S.__postblit` is not `nothrow`
fail_compilation/fail10964.d(35): Error: function `fail10964.S.__postblit` is not `nothrow`
fail_compilation/fail10964.d(28): Error: function `fail10964.S.this(this)` is not `nothrow`
fail_compilation/fail10964.d(29): Error: function `fail10964.S.this(this)` is not `nothrow`
fail_compilation/fail10964.d(30): Error: function `fail10964.S.this(this)` is not `nothrow`
fail_compilation/fail10964.d(33): Error: function `fail10964.S.this(this)` is not `nothrow`
fail_compilation/fail10964.d(34): Error: function `fail10964.S.this(this)` is not `nothrow`
fail_compilation/fail10964.d(35): Error: function `fail10964.S.this(this)` is not `nothrow`
fail_compilation/fail10964.d(22): Error: function `fail10964.foo` may throw but is marked as `nothrow`
---
*/

View file

@ -1,36 +1,36 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail10968.d(43): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(43): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(31): `fail10968.SA.__postblit` is declared here
fail_compilation/fail10968.d(44): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(44): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(31): `fail10968.SA.__postblit` is declared here
fail_compilation/fail10968.d(43): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(43): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
fail_compilation/fail10968.d(44): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(44): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
fail_compilation/fail10968.d(44): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.arrayassign._d_arraysetassign!(SA[], SA)._d_arraysetassign`
$p:druntime/import/core/internal/array/arrayassign.d$($n$): which calls `core.lifetime.copyEmplace!(SA, SA).copyEmplace`
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.__postblit`
fail_compilation/fail10968.d(45): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(45): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(31): `fail10968.SA.__postblit` is declared here
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.this(this)`
fail_compilation/fail10968.d(45): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(45): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
fail_compilation/fail10968.d(45): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.arrayassign._d_arrayassign_l!(SA[], SA)._d_arrayassign_l`
$p:druntime/import/core/internal/array/arrayassign.d$-mixin-$n$($n$): which calls `core.lifetime.copyEmplace!(SA, SA).copyEmplace`
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.__postblit`
fail_compilation/fail10968.d(48): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(48): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(31): `fail10968.SA.__postblit` is declared here
fail_compilation/fail10968.d(49): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(49): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(31): `fail10968.SA.__postblit` is declared here
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.this(this)`
fail_compilation/fail10968.d(48): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(48): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
fail_compilation/fail10968.d(49): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(49): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
fail_compilation/fail10968.d(49): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.construction._d_arraysetctor!(SA[], SA)._d_arraysetctor`
$p:druntime/import/core/internal/array/construction.d$($n$): which calls `core.lifetime.copyEmplace!(SA, SA).copyEmplace`
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.__postblit`
fail_compilation/fail10968.d(50): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(50): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.__postblit`
fail_compilation/fail10968.d(31): `fail10968.SA.__postblit` is declared here
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.this(this)`
fail_compilation/fail10968.d(50): Error: `pure` function `fail10968.bar` cannot call impure function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(50): Error: `@safe` function `fail10968.bar` cannot call `@system` function `fail10968.SA.this(this)`
fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared here
fail_compilation/fail10968.d(50): Error: `pure` function `fail10968.bar` cannot call impure function `core.internal.array.construction._d_arrayctor!(SA[], SA)._d_arrayctor`
$p:druntime/import/core/internal/array/construction.d$($n$): which calls `core.lifetime.copyEmplace!(SA, SA).copyEmplace`
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.__postblit`
$p:druntime/import/core/lifetime.d$($n$): which calls `fail10968.SA.this(this)`
---
*/

View file

@ -1,14 +1,14 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail18143.d(20): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(21): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(25): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(26): Error: variable `fail18143.S.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(35): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(36): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(40): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(41): Error: variable `fail18143.C.a` cannot modify parameter `this` in contract
fail_compilation/fail18143.d(20): Error: cannot modify member variable `fail18143.S.a` in contract
fail_compilation/fail18143.d(21): Error: cannot modify member variable `fail18143.S.a` in contract
fail_compilation/fail18143.d(25): Error: cannot modify member variable `fail18143.S.a` in contract
fail_compilation/fail18143.d(26): Error: cannot modify member variable `fail18143.S.a` in contract
fail_compilation/fail18143.d(35): Error: cannot modify member variable `fail18143.C.a` in contract
fail_compilation/fail18143.d(36): Error: cannot modify member variable `fail18143.C.a` in contract
fail_compilation/fail18143.d(40): Error: cannot modify member variable `fail18143.C.a` in contract
fail_compilation/fail18143.d(41): Error: cannot modify member variable `fail18143.C.a` in contract
---
*/

View file

@ -1,9 +1,9 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail4421.d(16): Error: function `fail4421.U1.__postblit` destructors, postblits and invariants are not allowed in union `U1`
fail_compilation/fail4421.d(16): Error: function `fail4421.U1.this(this)` destructors, postblits and invariants are not allowed in union `U1`
fail_compilation/fail4421.d(17): Error: destructor `fail4421.U1.~this` destructors, postblits and invariants are not allowed in union `U1`
fail_compilation/fail4421.d(18): Error: function `fail4421.U1.__invariant1` destructors, postblits and invariants are not allowed in union `U1`
fail_compilation/fail4421.d(18): Error: function `fail4421.U1.invariant` destructors, postblits and invariants are not allowed in union `U1`
---

View file

@ -1,8 +1,10 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail6107.d(10): Error: variable `fail6107.Foo.__ctor` is not a constructor; identifiers starting with `__` are reserved for the implementation
fail_compilation/fail6107.d(14): Error: variable `fail6107.Bar.__ctor` is not a constructor; identifiers starting with `__` are reserved for the implementation
fail_compilation/fail6107.d(12): Error: variable name `__ctor` is not allowed
fail_compilation/fail6107.d(12): identifiers starting with `__` are reserved for internal use
fail_compilation/fail6107.d(16): Error: variable name `__ctor` is not allowed
fail_compilation/fail6107.d(16): identifiers starting with `__` are reserved for internal use
---
*/
struct Foo

View file

@ -9,12 +9,12 @@ fail_compilation/fail7848.d(21): `fail7848.func` is declared here
fail_compilation/fail7848.d(27): Error: `@nogc` function `fail7848.C.__unittest_L25_C30` cannot call non-@nogc function `fail7848.func`
fail_compilation/fail7848.d(27): Error: function `fail7848.func` is not `nothrow`
fail_compilation/fail7848.d(25): Error: function `fail7848.C.__unittest_L25_C30` may throw but is marked as `nothrow`
fail_compilation/fail7848.d(32): Error: `pure` function `fail7848.C.__invariant0` cannot call impure function `fail7848.func`
fail_compilation/fail7848.d(32): Error: `@safe` function `fail7848.C.__invariant0` cannot call `@system` function `fail7848.func`
fail_compilation/fail7848.d(32): Error: `pure` function `fail7848.C.invariant` cannot call impure function `fail7848.func`
fail_compilation/fail7848.d(32): Error: `@safe` function `fail7848.C.invariant` cannot call `@system` function `fail7848.func`
fail_compilation/fail7848.d(21): `fail7848.func` is declared here
fail_compilation/fail7848.d(32): Error: `@nogc` function `fail7848.C.__invariant0` cannot call non-@nogc function `fail7848.func`
fail_compilation/fail7848.d(32): Error: `@nogc` function `fail7848.C.invariant` cannot call non-@nogc function `fail7848.func`
fail_compilation/fail7848.d(32): Error: function `fail7848.func` is not `nothrow`
fail_compilation/fail7848.d(30): Error: function `fail7848.C.__invariant0` may throw but is marked as `nothrow`
fail_compilation/fail7848.d(30): Error: function `fail7848.C.invariant` may throw but is marked as `nothrow`
---
*/

View file

@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice12902.d(20): Error: variable `ice12902.main.__dollar` - type `void` is inferred from initializer `s.opDollar()`, and variables cannot be of type `void`
fail_compilation/ice12902.d(20): Error: variable `ice12902.main.$` - type `void` is inferred from initializer `s.opDollar()`, and variables cannot be of type `void`
fail_compilation/ice12902.d(20): Error: expression `s.opDollar()` is `void` and has no value
---
*/