Skip to content

Dotty fails to to infer type params for Java Stream API #801

Closed
@DarkDimius

Description

@DarkDimius
object T{
  import java.util.ArrayList, java.util.stream.{Stream => JStream}
  new java.util.ArrayList[String]().stream.map(_.toInt).map(_.toString): JStream[String]
}
Streams.scala:3: error: toInt is not a member of <unknown instance of type java.util.function.Function[_ >: String, _ = Nothing]>
  .
java$util$function$Function$$T(_$1)
  new java.util.ArrayList[String]().stream.map(_.toInt).map(_.toString): JStream[String]
                                                 ^
Streams.scala:3: error: type mismatch:
 found   : <unknown instance of type java.util.function.Function[_ >: String, _ = Nothing]>
  .
java$util$function$Function$$T =>
  <unknown instance of type
    java.util.function.Function[_ >: String, _ = Nothing]
  >.java$util$function$Function$$R
 required: java.util.function.Function[_ >: String, _ <: Nothing']
  new java.util.ArrayList[String]().stream.map(_.toInt).map(_.toString): JStream[String]
                                               ^
Streams.scala:3: error: type mismatch:
 found   : String
 required: <unknown instance of type java.util.function.Function[_, _ <: String]>.
  java$util$function$Function$$R
  new java.util.ArrayList[String]().stream.map(_.toInt).map(_.toString): JStream[String]
                                                            ^
three errors found

see also https://groups.google.com/forum/#!msg/scala-language/Xy29pcRE04c/rwCvztHjsP8J for same issue for scalac

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