Skip to content

Commit

Permalink
Remove reference to _d_arrayassign in errors (#20808)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorpel authored Jan 30, 2025
1 parent 0ecefd7 commit d29e3ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
20 changes: 13 additions & 7 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -2371,8 +2371,14 @@ private bool checkNogc(FuncDeclaration f, ref Loc loc, Scope* sc)
}

/********************************************
* Check that the postblit is callable if t is an array of structs.
* Returns true if error happens.
* Check that the postblit of `t` isn't @disabled and has the right
* function attributes for this scope.
*
* Params:
* t = struct type, or static array of struct type to check
* loc = error message location
* sc = scope in which attributes are checked
* Returns: true if there's an error
*/
private bool checkPostblit(Type t, ref Loc loc, Scope* sc)
{
Expand All @@ -2395,12 +2401,12 @@ private bool checkPostblit(Type t, ref Loc loc, Scope* sc)
return true;

//checkDeprecated(sc, sd.postblit); // necessary?
sd.postblit.checkPurity(loc, sc);
sd.postblit.checkSafety(loc, sc);
sd.postblit.checkNogc(loc, sc);
//checkAccess(sd, loc, sc, sd.postblit); // necessary?
return false;

bool result = false;
result |= sd.postblit.checkPurity(loc, sc);
result |= sd.postblit.checkSafety(loc, sc);
result |= sd.postblit.checkNogc(loc, sc);
return result;
}

/***************************************
Expand Down
12 changes: 0 additions & 12 deletions compiler/test/fail_compilation/fail10968.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,18 @@ fail_compilation/fail10968.d(31): `fail10968.SA.this(this)` is declared h
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.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.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.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.this(this)`
---
*/

Expand Down

0 comments on commit d29e3ec

Please sign in to comment.