Skip to content

Use new subsignature API in class.c #23527

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

Draft
wants to merge 4 commits into
base: blead
Choose a base branch
from

Conversation

leonerd
Copy link
Contributor

@leonerd leonerd commented Aug 2, 2025

Towards the end of the 5.41.x development cycle I added a bunch of subsignature_*() API functions, for the parser to use to create subroutine signatures in an abstracted way. This will hide the inner details of how the optree is constructed, allowing future work (such as no-snails, or named parameters) to be done much easier. During that cycle I didn't quite get around to updating all the callsites; in particular, class.c did not yet use this new API.

This series of commits updates class.c to use this new API when creating subroutine signatures for its own generated method subs. Once this is done, it will be easier to update the way that signatures are performed internally.

I don't believe this needs a perldelta entry as it is just inner details of how class.c constructs subroutine CVs.

@@ -33,7 +33,7 @@ no warnings 'experimental::class';
# Read accessor does not permit arguments
ok(!eval { $o->s("value") },
'Reader accessor fails with argument');
like($@, qr/^Too many arguments for subroutine \'Testcase1::s\' \(got 1; expected 0\) at /,
like($@, qr/^Too many arguments for subroutine \'Testcase1::s\' \(got 2; expected 1\) at /,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the changes in this test not require a perldelta entry as they're a change in user-visible behaviour? I presume the extra plus one on each count is it now counts the implicit self in each count?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oooh, that is a fair point, yes. I should probably mention it. It's not likely to be very user-impacting, but it is technically visible.

@leonerd
Copy link
Contributor Author

leonerd commented Aug 2, 2025

msvc143 smoker failed in t/op/alarm.t as it often does. Doesn't look related to these changes.

@leonerd leonerd marked this pull request as draft August 4, 2025 16:34
@leonerd
Copy link
Contributor Author

leonerd commented Aug 4, 2025

Turns out while writing the perldelta for this, I tested something I thought should work only it doesn't. Seems there's a bunch more work to do first - I'll draft this for now until it's ready.

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.

2 participants