Skip to content

refactor(upgrade): explicitly specify type parameter in downcast method #3913

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

1911860538
Copy link

Make the type parameter passing more explicit by changing
io.__hyper_downcast() to io.__hyper_downcast::<T>() in the
downcast method. This improves code clarity and avoids potential
type inference ambiguities in multi-generic scenarios.

@seanmonstar
Copy link
Member

Thanks for the PR! What motivated this change? I think the original code is pretty clear and impossible for inference to mess up...

@1911860538
Copy link
Author

Thanks for the PR! What motivated this change? I think the original code is pretty clear and impossible for inference to mess up...

Yes, because this method has only one generic parameter, the original code is impossible to encounter type inference issues. My modification primarily aims to enhance readability. Improved code clarity is achieved as explicit type parameters clearly indicate the target downcast type, making the code more readable and self-documenting.

@seanmonstar
Copy link
Member

Hm, ok. I lean towards leaving it alone, but if another reviewer feels differently, I could be swayed. @hyperium/triage

@1911860538
Copy link
Author

Hm, ok. I lean towards leaving it alone, but if another reviewer feels differently, I could be swayed. @hyperium/triage

😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants