Skip to content

Union type found when inferring Array.empty #1907

Closed
@felixmulder

Description

@felixmulder
import java.io.File

object Test {
  Some(new File("."))
    .map(_.listFiles).getOrElse(Array.empty)
    .map(_.listFiles)
}

Error message:

value `map` is not a member of Array[java.io.File] | Array[T]
where:    T is a type variable which is an alias of Array[T]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions