I'm new to Rogue and relatively new to Scala.
I'm confused by a compilation error I'm seeing related DateTimeField. I'm not sure what's going on. This code
class FooBar extends BsonRecord[FooBar] {
def meta = FooBar
object foo extends StringField(this, 100)
object bar extends DateTimeField(this)
}
object FooBar extends FooBar with BsonMetaRecord[FooBar] {
def baz: FooBar = {
val r: FooBar = FooBar.createRecord.foo("abc").bar(new DateTime())
return r
}
}
Generates this error:
[error] type mismatch;
[error] found : Any
[error] required: api.model.FooBar
[error] val r: FooBar = FooBar.createRecord.foo("abc").bar(new DateTime())
When I change the line to
val r: FooBar = FooBar.createRecord.bar(new DateTime()).foo("abc")
I get
[error] value foo is not a member of Any
[error] val r: FooBar = FooBar.createRecord.bar(new DateTime()).foo("abc")
[error] ^
I'm at loss what's going on here. Thanks in advance for any help.
Daniel