[Issue 21674] [REG v2.086] `alias this` triggers wrong deprecation message on function call
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 17 09:52:20 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=21674
--- Comment #7 from Iain Buclaw <ibuclaw at gdcproject.org> ---
The cause of the regression is that the conditions that check this are looking
at the wrong thing.
---
if (Expression result = checkAliasThisForLhs(ad1, sc, e))
{
// Problem #1
// + e = `m.data = "Hello World"`
// + result = `m.data.str("Hello World")
// I think we should instead be looking at the `result{.e1}.op`, not the
// original expression.
if (e.op != EXP.assign || e.e1.op == EXP.type)
return result;
// Problem #2
// + ad1 = `S1`
// + result.var.parent = `EntryType`
// I think we should instead be looking at the aggregate declaration for
// the LHS of the rewritten `result`.
if (ad1.fields.dim == 1 || (ad1.fields.dim == 2 && ad1.vthis))
{
if (var && var.type == ad1.fields[0].type)
return result;
if (tf.isref && ad1.fields[0].type == tf.next)
return result;
}
}
---
--
More information about the Digitalmars-d-bugs
mailing list