Skip to content

missingEffectContext diagnostic incompatible with .pipe() #184

@mattrossman

Description

@mattrossman

What version of Effect is running?

3.16.3

What steps can reproduce the bug?

In an Effect project with @effect/language-service 0.19.0:

import { Terminal } from "@effect/platform"
import { NodeRuntime } from "@effect/platform-node"
import { Effect } from "effect"

const program = Effect.gen(function* () {
  yield* Terminal.Terminal
  yield* Effect.log("Hello Effect!")
  Effect.log("hello")
}).pipe(Effect.withSpan("program"))

program.pipe(NodeRuntime.runMain)

Resulting "Problems" reported in VSCode:

Image

I included the dangling Effect as a sanity check that the LSP is working.

What is the expected behavior?

I expect the language server to report a problem like:

Missing 'Terminal' in the expected effect context

What do you see instead?

I just see the less readable type error:

The 'this' context of type 'Effect<void, never, Terminal>' is not assignable to method's 'this' of type 'Effect<unknown, unknown, never>'.
  Type 'Terminal' is not assignable to type 'never'.

Additional information

Originally reported on Discord:
https://discord.com/channels/795981131316985866/1355071412519305366/1355187746368655462

Response from @mattiamanzati:

...that’s a bug I need to fix, basically .pipe(effect=>effect) is not always recognized as place where to check effect missing context/errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions