Skip to content

RedundantNewKeyword is raised on a type inheriting from an interface that inherits IDisposable #572

Description

@jp-fournier-dev

Description

Given the following code :

open System

type ISomeInterfaceWithDisposable =
    interface
        inherit IDisposable
    end

type SomeDisposableType() =
    interface ISomeInterfaceWithDisposable with
        member _.Dispose() = ()

module Program =
    let foo = new SomeDisposableType() :> ISomeInterfaceWithDisposable

Considering that the type is a disposable through the ISomeInterfaceWithDisposable interface, my expectations is that this needs a new keyword.

Repro steps

Run FSharpLint on the following code with 0.21.3

Expected behavior

The redundant key word error to not be raised (this is what I would expect)

Actual behavior

The redundant key word error is raised

Known workarounds

Remove the new keyword from all occurence of this pattenr

Related information

Issue occurs on 0.21.3
Doesn't occur on 0.21.2
Windows 10
dotnet 6

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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