Skip to content

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

Merged
spytheman merged 3 commits into
vlang:masterfrom
ttytm:checker/optimize-opt-and-res-typ-check
Mar 27, 2024
Merged

spytheman merged 3 commits into
vlang:masterfrom
ttytm:checker/optimize-opt-and-res-typ-check

Conversation

@ttytm

@ttytm ttytm commented Mar 26, 2024 •

Copy link
Copy Markdown
Member

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

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

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
@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.

2 participants