-
-
Save jorgeortiz85/1099811 to your computer and use it in GitHub Desktop.
I want line 15 to typecheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package demo | |
trait Bar | |
abstract class Foo[T] {} | |
object Foo { | |
implicit def FooFromBar[T <: Bar : Manifest]: Foo[T] = new Foo[T] { } | |
def apply[T : Foo] = implicitly[Foo[T]] | |
def baz[T : Foo](arg: T): Unit = { println("ha!")} | |
} | |
abstract class BaseBar(val a:String) extends Bar | |
abstract class Base { | |
type T <: BaseBar | |
implicit def manifestT: Manifest[T] | |
def getBar(a:String) : T | |
def send(a:String) = Foo.baz(getBar(a)) // Dear typechecker, why do you hate me? | |
} | |
class ConcreteBar(a:String) extends BaseBar(a) | |
object Concrete extends Base { | |
type T = ConcreteBar | |
implicit def manifestT = manifest[ConcreteBar] | |
def getBar(a:String) = new ConcreteBar(a) | |
// def send(a:String) = Foo.baz(getBar(a)) // I want to remove this line | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment