|
Scala example source code file (t2305.scala)
The Scala t2305.scala source codeimport java.util.ArrayList trait Bind[Z[_]] class MySerializable[X] extends java.io.Serializable object Bind { implicit val JavaArrayListBind: Bind[ArrayList] = new Bind[ArrayList] {} implicit val MySerializableBind: Bind[MySerializable] = new Bind[MySerializable] {} } object works { // this works fine: def runbind(implicit bind: Bind[MySerializable]) {} runbind } object breaks { def runbind(implicit bind: Bind[ArrayList]) {} runbind /*java.lang.AssertionError: assertion failed: java.io.Serializable at scala.Predef$.assert(Predef.scala:107) at scala.tools.nsc.symtab.Types$TypeRef.transform(Types.scala:1417) at scala.tools.nsc.symtab.Types$TypeRef.baseType(Types.scala:1559) */ } Other Scala examples (source code examples)Here is a short list of links related to this Scala t2305.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.