Skip to content

Nothing inferred in polymorphic, method with empty parameter list #7805

Closed
@biboudis

Description

@biboudis

Nothing inferred in polymorphic, method with empty parameter list but Int inferred when method is parameterless.

minimized code

object Test {
  def meth[R <: Int]() : R = ???
  def main(args: Array[String]): Unit = {
    val person: Int = meth()
  }
}

expectation

It should work the same either with or without a parameter list.

object Test {
  def meth[R <: Int]: R = ???
  def main(args: Array[String]): Unit = {
    val person: Int = meth
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions