Skip to content

Implicit dependent functions typing behaves incorrectly #5833

Closed
@guyde2011

Description

@guyde2011
object Dependent{
  def x: ( (i: Int) |=> Int ) = ???
  def y: ( (i: Int) |=> Int ) = x
}
object Independent{
  def x: ( Int |=> Int ) = ???
  def y: ( Int |=> Int ) = x
}
object NarrowDependent{
  def x: ( Int |=> Int ) = ???
  def y: ( (i: Int) |=> Int ) = x 
}
object WidenDependent{
  def x: ( (i: Int) |=> Int ) = ???
  def y: ( Int |=> Int ) = x 
}

Independent, NarrowDependent are compiled with no errors.
Dependent, WidenDependent both fail to compile:
Dependent:

Found:    => (i: Int) |=> Int(Dependent.x)
Required: Int

WidenDependent:

Found:    => (i: Int) |=> Int(WidenDependent.x)
Required: Int

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