Skip to content

conform to return-ref-scope ordering #10782

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

Merged
merged 1 commit into from
May 22, 2025
Merged

Conversation

WalterBright
Copy link
Member

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#10782"

@WalterBright
Copy link
Member Author

See #10782 for phobos fixes

Comment on lines +10789 to 10792
if (storageClasses[i] & ParameterStorageClass.return_)
result ~= "return ";
if (storageClasses[i] & ParameterStorageClass.scope_)
result ~= "scope ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why put return under the scope instead of ref? That looks like a breaking change as return ref scope will now be translated to return scope by ReplaceTypeUnless. Although, it's not ideal either way when ParameterStorageClass doesn't know about the storage class order like the compiler does.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The design of this function is deficient because one cannot control the order of ref, return and scope. I did the best I could with it to keep it working with the unittests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return ref and return scope should be distinct parameter storage classes, like in the compiler.

@dkorpel dkorpel merged commit 0145ed9 into dlang:master May 22, 2025
9 of 10 checks passed
@WalterBright WalterBright deleted the returnscope branch May 23, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants