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, cgen: fix codegen for option fntype #22280

Merged
merged 3 commits into from
Sep 22, 2024

Conversation

felipensp
Copy link
Member

Fix #22278

@felipensp felipensp marked this pull request as ready for review September 22, 2024 17:02
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
Copy link
Member

spytheman commented Sep 22, 2024

There is a small variation, that still produces a cgen error:

type DataFn = fn (name string) string
fn which_lang(name string) string { return name }
fn find_func(name string) ?DataFn {
	a := if name == 'vlang' { ?DataFn(which_lang) } else { none }
	return a
}

edit: filed as #22283 .

@spytheman
Copy link
Member

@felipensp should I file a separate issue for it?

@spytheman
Copy link
Member

spytheman commented Sep 22, 2024

Another (?) cgen error is triggered by:

type DataFn = fn (name string) string
fn which_lang(name string) string { return name }
fn find_func(name string) ?DataFn {
    a := ?DataFn( which_lang )
    return a
}

edit: filed as #22284 .

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.

Optional Function returns break everything
3 participants