Skip to content

Untagged structs cannot be unioned together #77

@cablumen

Description

@cablumen

Hi,

I am testing out unions in the 1.0.0-pre.2 release and running into issues when two structs are unioned together. For example, the .blink file below returns "[Error 3022]: Duplicate type used in union"

type foo = struct {
var1: u32,
var2: i16
}

type bar = struct {
var3: u8
}

type foo_bar_quax = foo | bar

The structs have no variable names or variable types in common, but are detected as duplicates because they are both structs. The example in unions.blink unions together a primitive type, a struct, and two tagged enums and this works fine, but I want to send a table that can hold different luau types. Tagged enums are probably the solution, but then every element in my table has a TagName key which is redundant with the luau type.

This might be an unsupported feature or my syntax is wrong and my use case is not covered in unions.blink.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions