Skip to content

Report missed pipeable calls used as method receivers - #777

Merged
mattiamanzati merged 3 commits into
Effect-TS:mainfrom
CasperEngl:fix/pipeable-method-receiver
Oct 6, 2026
Merged

mattiamanzati merged 3 commits into
Effect-TS:mainfrom
CasperEngl:fix/pipeable-method-receiver

Conversation

@CasperEngl

Copy link
Copy Markdown
Contributor

missedPipeableOpportunity now reports calls whose result is used as a method receiver, and the calls nested inside them, on Effect v3 and v4. Fixes #776

flowchart LR
  subgraph Before
    A1["Schema.NullishOr(Inner).annotations({...})"] --> B1["only the argument {...} is visited ❌"]
  end
  subgraph After
    A2["Schema.NullishOr(Inner).annotations({...})"] --> B2["the argument and the callee are visited ✅"]
    B2 --> C2["Schema.NullishOr(Inner) reported as Inner.pipe(...)"]
  end
Loading

TypeParser.pipingFlows queued only the argument of a single-argument call. For X.annotations({...}) the callee X.annotations was never traversed, so X and everything nested inside it was skipped. .pipe(...) calls already traverse their arguments; single-argument calls now traverse their callee the same way:

                 flowNode = node
+                // Queue the callee for independent traversal (e.g. the receiver of `X.annotations({...})`)
+                childrenToTraverse = [parsed.callee]
               }
// @test-config {"pipeableMinArgCount": 1}
const Inner = Schema.Struct({ a: Schema.String })

// now reported: `Inner.pipe(...)`
export const B = Schema.NullishOr(Inner).annotations({ identifier: "B" })

// now reported twice: the outer `Schema.NullishOr(...)` and the nested `Schema.Array(Inner)`
export const C = Schema.NullishOr(Schema.Struct({ x: Schema.Array(Inner) })).annotations({ identifier: "C" })
  • Tests: new missedPipeableOpportunity_receiver.ts fixture in both harnesses (.annotations on v3, .annotate on v4)
  • Reach: the other diagnostics built on pipingFlows now also see calls in these positions; none of their existing snapshots changed
  • Proof: ✅ pnpm check · ✅ pnpm test · ✅ pnpm test:v4 · ✅ pnpm codegen and pnpm lint-fix (no changes)
  • Not in scope: the skips from the issue's "Related" section (type guards, overloaded point-free calls, non-Effect pipe, React hooks). They change what the rule reports, so they're left for a separate discussion.

🤖 Generated with Claude Code

CasperEngl and others added 3 commits October 6, 2026 14:56
`pipingFlows` queued only the argument of a single-argument call, so a call
used as a method receiver, as in `Schema.NullishOr(Inner).annotations({...})`,
and everything nested inside it was never visited. `missedPipeableOpportunity`
now reports those calls on Effect v3 and v4.

Refs Effect-TS#776

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@changeset-bot

changeset-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 527d24b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/language-service Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CasperEngl
CasperEngl marked this pull request as ready for review October 6, 2026 13:09
@CasperEngl

Copy link
Copy Markdown
Contributor Author

@mattiamanzati this fixes #776. It's a one-line traversal change in pipingFlows, with fixtures for v3 and v4. The CI workflows are waiting for approval to run on this fork PR. Local pnpm check, pnpm test and pnpm test:v4 pass.

@mattiamanzati

Copy link
Copy Markdown
Contributor

Thanks for the PR!

@mattiamanzati
mattiamanzati merged commit 4478eec into Effect-TS:main Oct 6, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

missedPipeableOpportunity skips calls whose result is used as a method receiver

2 participants