Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue 22139 - Compiler special cases object.dup when compiling with -preview=dip1000 #13571

Merged
merged 1 commit into from
Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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