Skip to content

[BUG]: Metals glitch when implementing a trait wrong in a layer #1536

@markehammons

Description

@markehammons

Version

v1.0-RC1

Scala Version

3.8.3

Expected Behavior

Metals should be able to present an error when a class is missing members

Actual Behavior

2026.05.04 16:50:25 WARN Invalid text document uri received from build server: file:///home/mhammons/Projects/Haven/kyo-kernel/shared/src/main/scala/kyo/kernel/Pending.scala
2026.05.04 16:50:25 ERROR /home/mhammons/Projects/Haven/kyo-kernel/shared/src/main/scala/kyo/kernel/Pending.scala: error overriding method y in trait B of type => Unit < kyo.Sync;
method y of type => Int < kyo.Sync has incompatible type

Steps to Reproduce

The following code triggers the issues for metals:

trait A:
  def x: Unit < Sync

object A:
  def layer = Layer:
    new A:
      def x: Unit < Any = ???

trait B:
  def y: Unit < Sync

object B:
  def layer = Layer.from: (a: A) =>
    for _ <- a.x
    yield new B:
      def y: Int < Sync = ???

Current Workaround

Defining the implementation class outside of the layer definition results in normal errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions