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

comptime if and compile_error #15039

Closed
russo-2025 opened this issue Jul 12, 2022 · 0 comments · Fixed by #16938
Closed

comptime if and compile_error #15039

russo-2025 opened this issue Jul 12, 2022 · 0 comments · Fixed by #16938
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: Checker Bugs/feature requests, that are related to the type checker.

Comments

@russo-2025
Copy link

V version: V 0.3.0 9231697.ec19f42
OS: Microsoft Windows 10 Pro v19042 64-bit

What did you do?

module main

type Value = voidptr

pub fn create<T>(val T) Value {
    $if T is bool {
        return create_value_from_bool(val)
    }
    $else {
        $compile_error("asdasd")
        panic("error")
    }
}

fn create_value_from_bool(val bool) Value {
    return Value(voidptr(0))
}

fn main() {
    val1 := create(true) // <- error: asdasd
}

What did you expect to see?

What did you see instead?
error

@russo-2025 russo-2025 added the Bug This tag is applied to issues which reports bugs. label Jul 12, 2022
@felipensp felipensp self-assigned this Jan 10, 2023
@felipensp felipensp added the Unit: Checker Bugs/feature requests, that are related to the type checker. label Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants