I'm trying to implement a project where there are traits:
`trait Checkable`
`trait Closeable`
and a class:
`case class DBConnection (url: String) extends Checkable with Closeable`
and a function
`def generateConnection[T <: Checkable with Closeable](url: String): T = DBConnection(url)`
On compiling the above code, it generates error:
`Expression of type DBConnection doesn't conform to expected type T_`
What can I do to solve this issue?
I can use the expression:
`DBConnection(url).asInstanceOf[T]`
But I don't think it's the best practice