Created
December 27, 2011 20:45
-
-
Save jvshahid/1525066 to your computer and use it in GitHub Desktop.
Multiple implicits with the same name cause a compilation error
This file contains 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 bmrk.eod.parsing.examples.inference | |
import java.util.SortedMap | |
object Implicits { | |
implicit def implicitDef[T <: AnyRef](key:String,columns:SortedMap[String,String]) (implicit m:Manifest[T]):T = { | |
null.asInstanceOf[T] | |
} | |
// If the next method is removed this file will compile | |
implicit def implicitDef[T <: AnyRef](key:String,columns:List[(String,String)]) (implicit m:Manifest[T]): T = { | |
null.asInstanceOf[T] | |
} | |
} | |
class Test { | |
import Implicits._ | |
def someMethod[S](implicit anotherMethod:(String,SortedMap[String,String]) => (Manifest[S]) => S) = { | |
anotherMethod(null, null) | |
} | |
val foo = someMethod[String] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment