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

Implicit cast for enum literal to optionals and error unions #2867

Closed

Conversation

FireFox317
Copy link
Contributor

@FireFox317 FireFox317 commented Jul 11, 2019

This is a work in progress PR that solves issue #2811.

Work to be done:

  • Add implicit cast from enum literal to optionals
  • Add test for implicit cast from enum literal to optionals
  • Add implicit cast from enum literal to error unions
  • Add test for implicit cast from enum literal to error unions

@FireFox317 FireFox317 force-pushed the implicit-casts-enum-literal branch 2 times, most recently from 1867767 to 1fb6849 Compare July 11, 2019 15:16
@FireFox317 FireFox317 changed the title [WIP] Implicit cast for enum literal to optionals and error unions [WIP] Implicit cast for enum literal to optionals, error unions and error sets Jul 11, 2019
@FireFox317
Copy link
Contributor Author

Could maybe have more test coverage, but this includes some basic coverage.

@FireFox317 FireFox317 marked this pull request as ready for review July 11, 2019 18:04
@FireFox317 FireFox317 changed the title [WIP] Implicit cast for enum literal to optionals, error unions and error sets Implicit cast for enum literal to optionals, error unions and error sets Jul 11, 2019
@FireFox317 FireFox317 changed the title Implicit cast for enum literal to optionals, error unions and error sets WIP Implicit cast for enum literal to optionals, error unions and error sets Jul 16, 2019
@FireFox317 FireFox317 changed the title WIP Implicit cast for enum literal to optionals, error unions and error sets Implicit cast for enum literal to optionals and error unions Jul 20, 2019
@FireFox317 FireFox317 closed this Jul 22, 2019
@FireFox317 FireFox317 reopened this Jul 22, 2019
@FireFox317 FireFox317 closed this Jul 30, 2019
@FireFox317 FireFox317 reopened this Jul 30, 2019
@andrewrk andrewrk added this to the 0.5.0 milestone Aug 19, 2019
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is almost mergable, just needs some functionality deleted


test "implicit cast from enum literal to error union" {
var err1: Bar!u32 = .B;
var err2: anyerror!u32 = .RandomError;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is supposed to be a compile error. There's an ambiguity if it was anyerror!Enum and enum { RandomError }.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should now be solved

@andrewrk
Copy link
Member

andrewrk commented Sep 4, 2019

Landed in e540e5b

@andrewrk andrewrk closed this Sep 4, 2019
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.

None yet

2 participants