Skip to content

Unable to implement abstract class #3540

@saul

Description

@saul
namespace Microsoft.VisualStudio.FSharp.Editor.Tests.Roslyn

open Microsoft.CodeAnalysis.Options
open System.Collections.Immutable

type TestOptionSet(?values: ImmutableDictionary<OptionKey, obj>) =
    inherit OptionSet()

    let values = values |> Option.defaultValue ImmutableDictionary.Empty

    override __.GetOption(optionKey: OptionKey) =
        values.[optionKey]

    override __.WithChangedOption(optionAndLanguage: OptionKey, value: obj) =
        upcast TestOptionSet(values.SetItem(optionAndLanguage, value))

    // The member that I cannot override (FS0855)
    override __.GetChangedOptions(optionSet: OptionSet) : seq<OptionKey> =
        values
        |> Seq.filter (fun (KeyValue(k,v)) ->
            optionSet.GetOption(k) <> v
            )
        |> Seq.map (fun (KeyValue(k,_)) -> k)     

I get the error message:

FS0855	No abstract or interface member was found that corresponds to this override

If I remove the override keyword from the GetChangedOptions member, I then get the following error:

FS0365	No implementation was given for 'OptionSet.GetChangedOptions(optionSet: OptionSet) : System.Collections.Generic.IEnumerable<OptionKey>'

I believe this may have something to do with the fact that GetChangedOptions is internal, but I can't specify that with the override keyword, otherwise I get:

FS0941	Accessibility modifiers are not permitted on overrides or interface implementations

This is currently blocking me completing #3313

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