Bug 22790 – ref-return-scope is always ref-return, scope, unless return-scope appear in that order

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-02-19T00:49:25Z
Last change time
2022-03-21T17:27:31Z
Keywords
pull, safe
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2022-02-19T00:49:25Z
The rules around does ref-return-scope mean ref-return scope or does it mean ref return-scope turned out to be confusing and intractable. So I'm changing it to: ref-return-scope means: ref-return scope unless: "return scope" in that order appears in the source code. This should handle all the desired cases. But it breaks backwards compatibility. So it'll be put behind the -preview=dip1000 switch.
Comment #1 by bugzilla — 2022-02-19T00:51:28Z
For example: ref int foo(ref return scope int* p) means "ref" and "return scope". ref int foo(ref scope return int* p) means "return ref" and "scope".
Comment #2 by dlang-bot — 2022-02-19T00:52:39Z
@WalterBright updated dlang/dmd pull request #13691 "add inferReturnScope()" fixing this issue: - fix Issue 22790 ref-return-scope is always ref-return scope unless ref-scope appears in that order https://github.com/dlang/dmd/pull/13691
Comment #3 by dlang-bot — 2022-03-09T16:36:02Z
@dkorpel updated dlang/dmd pull request #13693 "Make consistent use of `STC.returnScope`" fixing this issue: - Fix issue 20881, 22790 - make ref-return-scope consistent https://github.com/dlang/dmd/pull/13693
Comment #4 by dlang-bot — 2022-03-10T21:18:06Z
dlang/dmd pull request #13691 "fix Issue 22790 - ref-return-scope is always ref-return, scope, unless return-scope appear in that order " was merged into master: - d8d378b246f37ae453ae2958f0820c91683c3a59 by Walter Bright: fix Issue 22790 ref-return-scope is always ref-return scope unless ref-scope appears in that order https://github.com/dlang/dmd/pull/13691
Comment #5 by dlang-bot — 2022-03-11T01:54:46Z
dlang/dmd pull request #13799 "Revert "fix Issue 22790 - ref-return-scope is always ref-return, scope, unless return-scope appear in that order "" was merged into master: - 03d265c9833ab6dea8b29f12dcb073ce1ecf2d25 by Dennis: Revert "fix Issue 22790 ref-return-scope is always ref-return scope unless ref-scope appears in that order (#13691)" This reverts commit f4437037b1b68a9b7b9197ff7649f82f97550e86. https://github.com/dlang/dmd/pull/13799
Comment #6 by dlang-bot — 2022-03-21T17:27:31Z
dlang/dmd pull request #13693 "Fix issue 20881, 22790 - make ref-return-scope consistent" was merged into master: - fce2d6529550931dc7ed35f904bbc7a6ac0cd8f0 by dkorpel: Fix issue 20881, 22790 - make ref-return-scope consistent https://github.com/dlang/dmd/pull/13693