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

method argument not used for prefix of implicit argument #6892

Open
scabug opened this issue Dec 29, 2012 · 2 comments
Open

method argument not used for prefix of implicit argument #6892

scabug opened this issue Dec 29, 2012 · 2 comments
Labels
dependent types fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) implicit infer
Milestone

Comments

@scabug
Copy link

scabug commented Dec 29, 2012

class Cake {
  trait Foo[T]
  object Foo {
    // if FooString is replaced with fooString, everything works
    // implicit val fooString = new Foo[String] {}
    implicit object FooString extends Foo[String]
  }
  def foo[T: Foo](x: T) = x
}

object Test extends App {
  def foo(c: Cake) = {
    // doesn't work: c.foo("1")
    // Test.scala:11: error: could not find implicit value for evidence parameter of type c.Foo[String]
    // c.foo("1")

    // this works
    val c1 = c
    c1.foo("1")
  }
}
@scabug
Copy link
Author

scabug commented Dec 29, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6892?orig=1
Reporter: @xeno-by

@scabug
Copy link
Author

scabug commented May 16, 2014

@adriaanm said (edited on May 16, 2014 10:54:55 AM UTC):
I suspect the argument c of def foo is somehow considered not in scope when typing FooString.

This works:

def foo(c: Cake): Unit = { 
  implicit val ev: c.Foo[String] /*return type crucial*/= c.Foo.FooString
  c.foo("1")
}

@scabug scabug added this to the Backlog milestone Apr 7, 2017
@SethTisue SethTisue added the fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependent types fixed in Scala 3 This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/) implicit infer
Projects
None yet
Development

No branches or pull requests

3 participants