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.
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".
@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
@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
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
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
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