Skip to content

enum func checks can go wrong #320

@bvdberg

Description

@bvdberg

The following fragments passes the analyser, but fails in C compilation.

module test;

type Kind enum u8 {
    A, B, C
}

fn bool Kind.isA(Kind k) {
    return k == A;
}

public fn i32 main() {
    Kind k = A;
    bool is_a = !k.isA;   // forget ()
// Note bool is_a = k.isA;   does give a c2c error

    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions