Skip to content

Disambiguate methods with different return types based on explicitly specified type parameter #4561

Closed
@pweisenburger

Description

@pweisenburger

The following code compiles using Scala:

object abc {
  trait Test0
  trait Test1 { def apply(f: Int => Int): Unit }

  def v: Test0 = ???
  def v[T]: Test1 = ???

  v[Any] { v => v }
}

Dotty produces the following compiler error:

8 |  v[Any] { v => v }
  |           ^
  |missing parameter type
  |
  |The argument types of an anonymous function must be fully known. (SLS 8.5)
  |Expected type: ?
  |Missing type for parameter v

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