1
のは、私は次のコードがあるとしましょう:Scalaの暗黙および型の別名
object Potato extends App {
type CoolString = String
type AwesomeString = String
def potato(string: String)(implicit coolString: CoolString, awesomeString: AwesomeString) = {
s"$string is a string. Oh, but don't forget - $coolString and also $awesomeString"
}
implicit val ice : CoolString = "Really Cold Ice"
implicit val awe : AwesomeString = "Awe inspiring object"
potato("Stringerino")
}
このコードは問題
[error] ... ambiguous implicit values:
[error] both value ice in object Potato of type => Potato.CoolString
[error] and value awe in object Potato of type => Potato.AwesomeString
[error] match expected type Potato.CoolString
[error] potato("Stringerino")
で失敗することは不可能暗黙のような使用ですか?