This page is no longer maintained — Please continue to the home page at

Return type problem.

No replies
Joined: 2011-09-14,
User offline. Last seen 28 weeks 3 days ago.

class ComplexCurveSecuritiesCollection[T <: SecurityImpl,X<:TermStructure](private val subcollections: IndexedSeq[GenericCurveSecuritiesCollection[T,X]]) extends CurveSecuritiesCollection[T] {
  type SubType = ComplexCurveSecuritiesCollection[T,X]
  type TermStructureType = X
  def filter(f: (T) => Boolean) = {    val newCollections =>item.filter(f));     new ComplexCurveSecuritiesCollection[T,X](newCollections);  }
error: type mismatch;found   : IndexedSeq[[T,X]#SubType] required: IndexedSeq[[T,X]]new ComplexCurveSecuritiesCollection[T,X](newCollections);
trait CurveSecuritiesCollection[T <: SecurityImpl] extends RepriceableAndPublisheableCollection with java.lang.Iterable[T] {
  type SubType <: CurveSecuritiesCollection[T]

  def filter(f: (T) => Boolean): SubType
What is wrong in my code?
Best RegardsEdmondo Porcu

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland