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: fix comptime if branch checking #16938

Merged
merged 15 commits into from Jan 14, 2023

Conversation

felipensp
Copy link
Member

Fix #15039

pub fn create<T>(val T) Value {
    $if T is bool {
		println('bool ${val}')
        return create_value_from_bool(val)
    }
    $else {
		$compile_error('11')
		println('not bool ${val}')
    }

	return Value(voidptr(0))
}

The code above was throwing $compile_error even when T is bool. This PR fixes such behavior.

@felipensp felipensp changed the title fix comptime if checking checker: fix comptime if checking Jan 10, 2023
@felipensp felipensp changed the title checker: fix comptime if checking checker: fix comptime if branch checking Jan 10, 2023
@felipensp felipensp marked this pull request as ready for review January 11, 2023 14:04
…e compile time error, and the now passing expansion without $compile_error
@spytheman spytheman merged commit 71e8fc8 into vlang:master Jan 14, 2023
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.

comptime if and compile_error
2 participants