Skip to content

Enum variant equality test is not commutative #10331

@mcastorina

Description

@mcastorina

V version: V 0.2.2 bf623e1
OS: linux

What did you do?

enum Enum { a b }

fn test(x Enum) bool {
	return .a == x
}

dump(test(.a))

What did you expect to see?

[test.v:7] test(.a): true

What did you see instead?
Compile error

test.v:4:9: error: expected type is not an enum (`bool`)
    2 | 
    3 | fn test(x Enum) bool {
    4 |     return .a == x
      |            ~~
    5 | }
    6 |

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: CheckerBugs/feature requests, that are related to the type checker.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions