Skip to content

RenderingT still has unsafe variance #1340

@steve-the-edwards

Description

@steve-the-edwards

I brought back the out RenderingT variance declaration because we use the covariance across RenderingT for workflows quite a bit (#1328). I thought we did not need to remove it for RenderingT.

However, while not immediately clear (in fact I don't think my IDE was even showing me the error at first), it still has UnsafeVariance when we create the inner class RenderContext<PropsT, StateT, OutputT> :(.

The reason is that we use the PropsT, StateT, and OutputT that are defined on the StatefulWorkflow or StatelessWorkflow instance that surrounds the inner class of RenderContext, so we are still passing in (consuming) the instance that defines RenderingT when we create RenderContext<PropsT, StateT, OutputT> which has no direct use of RenderingT itself. 😢 .

Why did this work? Well I believe this worked because by the time I brought back out RenderingT we had specified kotlinLanguageVersion = 1.9 to the compiler, which means UnsafeVariance is still allowed until we use the K2 compiler.

So this still needs to be fixed somehow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions