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

ability to explicitly cast from integer to error type #294

Closed
andrewrk opened this issue Apr 2, 2017 · 0 comments
Closed

ability to explicitly cast from integer to error type #294

andrewrk opened this issue Apr 2, 2017 · 0 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Apr 2, 2017

error ItBroke;
test "explicit cast from integer to error type" {
    impl(error.ItBroke);
    comptime impl(error.ItBroke);
}
fn impl(err: error) {
    const x = usize(err);
    const y = error(x);
    assert(error.ItBroke == y);
}
@andrewrk andrewrk added the enhancement Solving this issue will likely involve adding new logic or components to the codebase. label Apr 2, 2017
@andrewrk andrewrk added this to the 0.1.0 milestone Apr 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

No branches or pull requests

1 participant