Skip to content
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

checker: optimize option and result typ check, add more typinfo to error details #21105

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Mar 26, 2024

The main change of the PR is improving error messages to provide more details on return types. The changes serve as a base for a bugfix in a followup but take up their own scope so they are submitted separately.

The PR intentionally makes minimal changes to the error messages, keeping it similar to the current state. Imho the error messages can generally be optimized here by using error details to split things up into showing an expressive error message and providing a recommendation for action. But that's a scope for a separate PR as well.

There are also minor optimization to the codeblock of the check. It moves variables assignments deeper into the block scope where they are used and removes a duplicate conditional check. Modern compilers should be smart enough to optimize such variable assignments, so the optimization likely mainly helps with read-/maintainability.

@ttytm ttytm changed the title checker: optimize option and result typ check, add more typinfo to error details. checker: optimize option and result typ check, add more typinfo to error details Mar 26, 2024
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit bc68c87 into vlang:master Mar 27, 2024
54 checks passed
@ttytm ttytm deleted the checker/optimize-opt-and-res-typ-check branch March 27, 2024 12:16
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.

None yet

2 participants