Ah, that makes sense. Thanks!

On Thu, Feb 19, 2009 at 10:10 AM, David Pollak <
feeder.of.the.be...@gmail.com> wrote:

>
>
> On Thu, Feb 19, 2009 at 6:49 AM, Derek Chen-Becker 
> <dchenbec...@gmail.com>wrote:
>
>> 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.
>
>
> This is because the :: (cons) operation does inference on each cons
> element, rather than the List as a whole.  At some point, it gets confused.
> Please use List().
>
>
>>
>>
>> Derek
>>
>>
>> On Thu, Feb 19, 2009 at 2:35 AM, Jorge Ortiz <jorge.or...@gmail.com>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 <
>>> dchenbec...@gmail.com> 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
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to