Skip to content

Missing/abstract param accessor in implicit parameter of trait #2795

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

Closed
nicolasstucki opened this issue Jun 23, 2017 · 1 comment
Closed

Comments

@nicolasstucki
Copy link
Contributor

trait Foo[T: ClassTag]() {
  def foo(x: T) = Array(x)
}
class Bar extends Foo[Int]()

fails with a java.lang.AbstractMethodError: Method Bar.Foo$$evidence$1()Lscala/reflect/ClassTag; is abstract

Where the tree after genBCode looks like

<trait> trait Foo extends Object { 
    def $init$(): Unit = ()
    implicit <accessor> def Foo$$evidence$1(): scala.reflect.ClassTag
    def foo(x: Object): Object = 
      Array.apply(Predef.genericWrapArray([x : Object]), this.Foo$$evidence$1())
  }
class Bar
   extends Object with Foo { 
    def <init>(): Unit = 
      {
        super()
        super[Foo].$init$()
        ()
      }
  }
@nicolasstucki
Copy link
Contributor Author

Note that stating the implicit parameter explicitly does work

class Foo[T]()(implicit ct: ClassTag[T]) {
  def foo(x: T) = Array(x)
}
class Bar extends Foo[Int]()

odersky added a commit that referenced this issue Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant