Skip to content

mapping futures succeeds typecheck when it shouldn't #9822

@scabug

Description

@scabug
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

  def future1: Future[Unit] = Future.successful(())
  def future2: Future[Unit] = Future.successful(())

  def test: Future[Unit] = future1.map { _ => future2 }

the body of the test function returns Future[Future[Unit]], however, the compiler is happy to say that it is simply a Future[Unit], which leads to errors in code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions