Skip to content

Return type accuracy and usage improvements #7891

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 4 commits into
base: dev/feature
Choose a base branch
from

Conversation

APickledWalrus
Copy link
Member

@APickledWalrus APickledWalrus commented May 23, 2025

Problem

Some Expressions/Classes are not taking full advantage of the multiple return types system. Others have return types that are incorrectly setup. Ensuring detailed return types is also important for features like local variable type hints.

Solution

I aim to integrate usage of Expression#possibleReturnTypes and Expression#canReturn where possible. I've also cleaned up some classes that were in need of it (to improve their return type logic).

A major change that I made is Expression#canReturn will always return true if one of the possible return types is Object. This appears to work without issue, but further testing is needed.

There may be additional classes that need updated. I will continue searching for them. However, this is ready for an initial review.

Testing Completed

No additional tests have been added yet. Coverage of the modified syntaxes is present, though some additional tests might be possible to test the behavior.

Supporting Information

n/a


Completes: #5060 (needs testing)
Related: none

@APickledWalrus APickledWalrus requested a review from a team as a code owner May 23, 2025 17:34
@APickledWalrus APickledWalrus added the bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. label May 23, 2025
@APickledWalrus APickledWalrus requested a review from a team as a code owner May 23, 2025 17:34
@APickledWalrus APickledWalrus added the enhancement Feature request, an issue about something that could be improved, or a PR improving something. label May 23, 2025
@APickledWalrus APickledWalrus removed the request for review from a team May 23, 2025 17:34
@APickledWalrus APickledWalrus added the needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls. label May 23, 2025
@APickledWalrus APickledWalrus requested review from UnderscoreTud and cheeezburga and removed request for a team May 23, 2025 17:34
@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label May 23, 2025
@APickledWalrus APickledWalrus changed the title Return type improvements Return type accuracy and usage improvements May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue that needs to be fixed. Alternatively, a PR fixing an issue. enhancement Feature request, an issue about something that could be improved, or a PR improving something. needs reviews A PR that needs additional reviews needs testing Needs testing to determine current status or issue validity, or for WIP feature pulls.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants