Skip to content

Type inference regression versus Scala 2 #8111

Closed
@adamgfraser

Description

@adamgfraser

minimized code

object Example extends App {
  
  def assertLazy[A, B](f: (=> A) => B): Boolean = ???
  
  def fromEither[E, A](eea: => Either[E, A]): Unit = ???
  
  lazy val result = assertLazy(fromEither)
  
  println("It compiles!")
}
Found:    Any
Required: Either[Any, Any]

expectation

I would expect this code to compile as it does on Scala 2. assertLazy is completely polymorphic in its type other than being by name, which fromEither satisfies, so this should work. The issue appears to be related to the fact that the argument to fromEither has two type parameters. If I try it with an argument with only one parameter it works correctly.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions