Closed JohelEGP closed 8 months ago
Thanks! I think just the name operator++
and operator--
should be enough, because there should be no other signature allowed... I am now updating this PR to add a sema check to enforce that.
Also I'll remove the word "prefix" to avoid confusion because ++
/--
are only postfix in Cpp2, though they lower to Cpp1 prefix operators.
Thanks! I think just the name
operator++
andoperator--
should be enough, because there should be no other signature allowed... I am now updating this PR to add a sema check to enforce that.
Do you mean in function_type_node::is_increment_or_decrement
?
There's the _: int
signature for post-increment for Cpp1 compatibility.
We want those to continue to be [[nodiscard]]
.
operator++: (inout this, _: int) …
Do you mean in
function_type_node::is_increment_or_decrement
?
Yes, I was going to rename the new function to that (from is_prefix_increment_or_decrement
).
There's the
_: int
signature for post-increment for Cpp1 compatibility. We want those to continue to be[[nodiscard]]
.
Ah, that's an oversight -- I don't think I noticed that you could still author that. My mental model was that Cpp2 has only postfix increment/decrement with in-place semantics, but now that I'm looking at your note, I think the right answer is Cpp2 should generate both Cpp1 versions (prefix and postfix, the latter with [[nodiscard]]
) from the Cpp2 version. That way a Cpp2 type still has the correct simple mental model, but Cpp1 call sites are still able to use postfix for full compatibility.
Thanks!
Resolves #882.
Testing summary:
Acknowledgements: