Skip to content

Commit

Permalink
Fix issue 22139 - Compiler special cases object.dup when compiling wi…
Browse files Browse the repository at this point in the history
…th -preview=dip1000
  • Loading branch information
dkorpel authored and dlang-bot committed Jan 28, 2022
1 parent 71ba3fa commit 3a63145
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/dmd/dcast.d
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,8 @@ MATCH implicitConvTo(Expression e, Type t)
* convert to immutable
*/
if (e.f &&
(global.params.useDIP1000 != FeatureState.enabled || // lots of legacy code breaks with the following purity check
e.f.isPure() >= PURE.const_ ||
// Special case exemption for Object.dup() which we assume is implemented correctly
e.f.ident == Id.dup &&
e.f.toParent2() == ClassDeclaration.object.toParent()) &&
// lots of legacy code breaks with the following purity check
(global.params.useDIP1000 != FeatureState.enabled || e.f.isPure() >= PURE.const_) &&
e.f.isReturnIsolated() // check isReturnIsolated last, because it is potentially expensive.
)
{
Expand Down

0 comments on commit 3a63145

Please sign in to comment.