Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overload resolution falls into inference failures if we rely on return type adaptation with a polymorphic view #8230

Open
scabug opened this issue Feb 3, 2014 · 2 comments
Assignees
Labels

Comments

@scabug
Copy link

scabug commented Feb 3, 2014

trait Arr[T]
object Arr {
  def apply[T](xs: T): Arr[T]    = null
  def apply(x: Long) : Arr[Long] = null
}

object I {
  implicit def arrToTrav[T] (a: Arr[T])   : Traversable[T]    = null
  implicit def longArrToTrav(a: Arr[Long]): Traversable[Long] = null
}
  
object Test {
  def foo(t: Traversable[Any]) {}

  object Okay {
    Arr("1")

    import I.{ arrToTrav, longArrToTrav }
    foo(Arr("2"))
  }

  object Fail {
    import I.arrToTrav
    foo(Arr("3")) // found String, expected Long
  }
}

Extracted from a bootstrap failure I encountered when messing with error reporting from isCompatble/ viewExists in #8219

@scabug
Copy link
Author

scabug commented Feb 3, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8230?orig=1
Reporter: @retronym
Affected Versions: 2.10.3

@scabug
Copy link
Author

scabug commented Feb 4, 2014

@retronym said:
Pending test and analysis: https://github.com/retronym/scala/compare/ticket/8230

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants