Skip to content

Typer failure on ambiguous type argument #926

Open
@jiribenes

Description

@jiribenes

Error: Cannot fully infer type for addError: [T, E](Result[T, E], E) => Result[T, E]

type Result[T, E] {
  Success(value: T)
  Failure(errors: List[E])
}

def addError[T, E](result: Result[T, E], e: E) =
  result match {
    case Success(value)  => Failure([e])             // also error: Cannot infer type argument T, maybe consider annotating it?
    case Failure(errors) => Failure(Cons(e, errors)) // also error: Cannot infer type argument T, maybe consider annotating it?
  }

Reproducible both on the website and on v0.25.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions