SHOW:
|
|
- or go back to the newest paste.
| 1 | package quickstart.models.test | |
| 2 | ||
| 3 | import quickstart.model._ | |
| 4 | import com.mongodb.casbah.Imports._ | |
| 5 | ||
| 6 | import scalaz._ | |
| 7 | import Scalaz._ | |
| 8 | ||
| 9 | object MongoFun {
| |
| 10 | trait SMongoDB {
| |
| 11 | self: MongoDB => | |
| 12 | type SMongoCollection = Validation[String, MongoCollection] | |
| 13 | ||
| 14 | override def getCollection(collection:String):SMongoCollection = try {
| |
| 15 | success((this(collection))) | |
| 16 | } catch {
| |
| 17 | case ex => failure(ex.getMessage) | |
| 18 | } | |
| 19 | } | |
| 20 | ||
| 21 | implicit def toSMongoDB(db:MongoDB) = new MongoDB(db.underlying) with SMongoDB | |
| 22 | - | } |
| 22 | + | } |
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | [info] Compiling 1 Scala source to /home/eof/Projects/Xitrum/xitrum-new/target/scala-2.9.1/test-classes... | |
| 27 | [error] /home/eof/Projects/Xitrum/xitrum-new/src/test/scala/ModelsSpec.scala:26: overriding method getCollection in class MongoDB of type (name: String)com.mongodb.DBCollection; | |
| 28 | [error] method getCollection in trait SMongoDB of type (collection: String)this.SMongoCollection has incompatible type | |
| 29 | [error] implicit def toSMongoDB(db:MongoDB) = new MongoDB(db.underlying) with SMongoDB | |
| 30 | [error] ^ | |
| 31 | [error] one error found | |
| 32 | [error] {file:/home/eof/Projects/Xitrum/xitrum-new/}default-169585/test:compile: Compilation failed
| |
| 33 | [error] Total time: 2 s, completed 24-mar-2012 11:17:57 |