Skip to content

Typed enum defined with typed literal initialization should produce validations for incompatible types #1694

Description

@Angus-Bethke-Bachmann

Describe the bug
When a typed enum with typed literal initializations have incompatible types, the type is silently defaulted to the type of the enum. This should raise a validation error or warning.

To Reproduce
Steps to reproduce the behavior:

TYPE
    myEnum : (e1 := LINT#20, e2 := BYTE#30) BYTE;
END_TYPE

Results in the IR:

@myEnum.e2 = unnamed_addr constant i8 30
@myEnum.e1 = unnamed_addr constant i8 20

Expected behavior
A validation error or warning should be raised showing that the type LINT is incorrect for the enum definition (or will be truncated).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions