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: check option propogation in multi return types #19443

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented Sep 25, 2023

Closes #18566

🤖 Generated by Copilot at f90c01d

This pull request adds a checker error for multi-assignment with optional values that are not handled or propagated. It also adds a test case for the error using the split_once method from the strings module.

🤖 Generated by Copilot at f90c01d

  • Add a check for multi-assignment with optional values (link)
    • Report an error if the optional value is not handled or propagated (link, link)

@Delta456 Delta456 marked this pull request as draft September 25, 2023 21:26
@felipensp
Copy link
Member

I think it should not be automatically propaged.

I could have intentional none values from the multi return values. And so handle it logically, not returning because some value is none.

Example:

fn get() (?int, ?f64) {
	return 1, none
}

fn main() {
	x, y := get()

	if x != none {
		println('x')
	} else {
		println('y')
	}
}

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.

builder error trying to assign tuple through if in compile-time code
2 participants