Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Yield prevents implicit cast to interface type #545

@FrankBro

Description

@FrankBro

Using yield when building a collection seems to prevent implicit cast to the interface type expected

type IFirst = interface end

type ISecond = 
    inherit IFirst

module Test = 
    let instance = { new ISecond }

    let test () =
        let a : IFirst list =
            [
                instance
            ]
        let b : IFirst list = 
            [
                yield instance
            ]
        ()

In this example, you will get an error for b:

This expression was expected to have type
    IFirst    
but here has type
    ISecond

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