Nimblesite / Nimblesite/SharpLsp

F# interface-stub generator re-offers a property already implemented via explicit get/set accessors

Open
#206 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
132
Forks
5
Avg merge
6h 24m
Merged PRs (30d)
27

Description

What

Given an interface member abstract member Value: int with get, set implemented as:

type BothAccessors() =
    let mutable current = 0
    interface IStore with
        member _.Value
            with get () = current
            and set value = current <- value

FSharpCodeActions.tryGenerateInterfaceStub still offers Value among the members to generate. Accepting the fix would emit a second Value beside the existing accessors, which does not compile.

This is the implementation being complete, not a partial one

Confirmed against the compiler — the with get () = ... and set v = ... form does fully satisfy abstract member Value: int with get, set. A standalone project containing exactly the type above plus member _.Reset() = ... builds with 0 errors. So the member really is implemented and should be excluded from the candidate set.

The genuinely-partial forms behave correctly: a getter-only or setter-only implementation leaves the other half outstanding, and offering Value again there is right.

Where

implementedMemberSignatures / the candidate scan in FSharpCodeActions.fs appears not to recognise a SynMemberDefn.GetSetMember carrying both accessors as satisfying both halves of the abstract property.

Tests

FSharpAccessorStubTests covers the three accessor shapes. The get/set case deliberately asserts only that the genuinely missing Reset is offered, rather than pinning the duplicate Value as expected behaviour — so it will not need weakening when this is fixed, only strengthening with Assert.DoesNotContain("Value", text).

Notes

Pre-existing, not a regression from #200. Found while closing that PR's F# coverage gap.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in FSharpCodeActions.fs at implementedMemberSignatures and the candidate scan, then inspect the get/set cases in FSharpAccessorStubTests. Run the accessor stub tests first. Update handling for a SynMemberDefn.GetSetMember with both accessors so the completed Value is not offered while the missing Reset remains available, and verify getter-only and setter-only cases still offer the incomplete member.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.