Skip to content

Avoid false FS1113 on inline instance members with class-scope self identifiers#19761

Draft
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-fs1113-error-class-scope
Draft

Avoid false FS1113 on inline instance members with class-scope self identifiers#19761
Copilot wants to merge 5 commits into
mainfrom
copilot/fix-fs1113-error-class-scope

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 18, 2026

Inline instance members in classes currently fail with FS1113 when a class-scope self identifier is present (type C() as self = ...), even though the member body is valid. This change removes that false-positive path while preserving FS1113 behavior for non-member inline values.

  • Compiler behavior change (Optimizer)

    • Updated inline-completeness enforcement to apply only to non-member values.
    • CheckInlineValueIsComplete now skips the IsPartialExprVal/FS1113 check when v.IsMember is true.
  • Regression coverage (ComponentTests)

    • Added a focused test in MemberDeclarations covering the three reported forms:
      • class-scope self + different member self identifier
      • class-scope self + same member self identifier
      • class-scope self + _ member self identifier
type TestClass1() as SomeSelfIdentifier =
    member inline AnotherSelfIdentifier.test() = 5

type TestClass2() as self =
    member inline self.test() = 5

type TestClass3() as self =
    member inline _.test() = 5

Copilot AI changed the title [WIP] Fix FS1113 error with inline member in class scope Avoid false FS1113 on inline instance members with class-scope self identifiers May 18, 2026
Copilot finished work on behalf of T-Gro May 18, 2026 12:34
Copilot AI requested a review from T-Gro May 18, 2026 12:34
Copy link
Copy Markdown
Member

@T-Gro T-Gro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is correct. Class-scope self identifiers (as self) produce UnknownValue in the optimizer representation, causing spurious FS1113 for inline members. Skipping the check for all members via not v.IsMember is sound because:

  1. Accessibility for inline members is already enforced by FS0044 at type-check time
  2. Partial optimizer data for members is expected (self-parameter handling) and doesn't indicate a broken inline
  3. The internal error at line 4217 still guards against truly unresolvable inline data

The test covers the three reported forms cleanly. LGTM.

@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label May 20, 2026
@T-Gro T-Gro self-requested a review May 20, 2026 12:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.100.md

T-Gro and others added 2 commits May 25, 2026 13:51
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@T-Gro
Copy link
Copy Markdown
Member

T-Gro commented May 25, 2026

/azp run fsharp-ci

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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

Labels

AI-reviewed PR reviewed by AI review council

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Error FS1113 when creating a class with a class scope self-identifier and an inline member

2 participants