Shouldn't it be override def fieldOrder: List[BaseOwnedMappedField[Transaction]] = txtime :: amount :: summary :: Nil
I did try that and it gave the same error. In any case, List(...) works. Derek On Thu, Feb 19, 2009 at 2:35 AM, Jorge Ortiz <[email protected]> wrote: > Yup, this is a type inference bug. If I'm not mistaken then > > override def fieldOrder: BaseOwnedMappedField[Transaction] = txtime :: > amount :: summary :: Nil > > should also work. > > In any case, I'd probably just stick with the List(...) syntax. > > --j > > > On Wed, Feb 18, 2009 at 10:23 PM, Derek Chen-Becker <[email protected] > > wrote: > >> 0.11-SNAPSHOT, and I'm writing up some example code for the book. I have >> the following class/object: >> >> class Transaction extends LongKeyedMapper[Transaction] with IdPK { >> def getSingleton = Transaction >> >> object account extends MappedLongForeignKey(this, Account) { >> override def dbIndexed_? = true >> } >> >> object txtime extends MappedDateTime(this) >> >> // The amount has up to 16 digits and 2 decimal places >> object amount extends MappedDecimal(this, MathContext.DECIMAL64, 2) >> >> // Holds a brief description of the transaction >> object summary extends MappedString(this, 100) >> >> object notes extends MappedTextarea(this, 1000) { >> override def textareaCols = 60 >> override def textareaRows = 8 >> } >> >> def tags = TransactionTag.findAll(By(TransactionTag.transaction, >> this.id)) >> } >> >> object Transaction extends Transaction with >> LongKeyedMetaMapper[Transaction] { >> override def fieldOrder = txtime :: amount :: summary :: Nil >> } >> >> The compile error I get is: >> >> [WARNING] >> /home/software/pocketchangeapp/PocketChange/src/main/scala/com/pocketchangeapp/model/Transaction.scala:35: >> error: inferred type arguments [net.liftweb.mapper.MappedField[_ >: _1 with >> java.util.Date <: java.io.Serializable, >> com.pocketchangeapp.model.Transaction]] do not conform to method ::'s type >> parameter bounds [B >: net.liftweb.mapper.MappedField[_ >: String with >> BigDecimal <: java.io.Serializable, >> com.pocketchangeapp.model.Transaction]{def jdbcFriendly(String): >> java.io.Serializable}] >> [WARNING] override def fieldOrder = txtime :: amount :: summary :: Nil >> [WARNING] ^ >> [WARNING] one error found >> >> If I remove the "summary" element from the fieldOrder list then it >> compiles fine. Likewise, if I remove txtime and put summary and notes into >> the list it compiles fine. I'm trying to get my head around all of the >> nested type bounds in the error message but I'm not seeing anything obvious >> other than the weird "String with BigDecimal" bound. I tried using an >> explicit type for fieldOrder but that doesn't work either. >> >> I finally tried changing fieldOrder to: >> >> override def fieldOrder = List(txtime, amount, summary, notes) >> >> That compiles fine. Have I found a type inferencing bug, or have I just >> done something incredibly stupid somewhere? Feel free to critique the class, >> too. >> >> Thanks, >> >> Derek >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---
