Skip to content

Fix implicit conversion for Union #8347

Closed
@flobernd

Description

@flobernd

Union implements implicit conversion like this:

public static implicit operator Union<TFirst, TSecond>(TFirst first) => new(first);
public static implicit operator Union<TFirst, TSecond>(TSecond second) => new(second);

When a class derives from Union<,> the implicit conversion operators can't be used, because their result Union<,> can't be upcasted to the derived type.

To fix this issue, code generator should always generate specialized conversion operators for types derived from Union<,>.

Related to #8345

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions