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

Suggestion: "if is" with dual-union and "else" #267

Closed
quintesse opened this issue Apr 7, 2012 · 2 comments
Closed

Suggestion: "if is" with dual-union and "else" #267

quintesse opened this issue Apr 7, 2012 · 2 comments

Comments

@quintesse
Copy link
Member

Imagine this:

Foo|Bar gimmeEither() { ... }

and this code trying to use it:

if (is Foo x = gimmeEither()) {
    // We already know x is Foo here
} else {
    // NEW But couldn't the typechecker figure out x has to be Bar here?
}

For dual typed unions (which might be often used in cases like Result|Error) this might be useful.

@ikasiuk
Copy link
Member

ikasiuk commented Apr 7, 2012

Is this any different from #74?

@quintesse
Copy link
Member Author

Damn, I had forgotten about that one ;)
Closing

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

No branches or pull requests

2 participants