java - Getting around type erasure: problem with trait type! -


I want to go around the type of error in case of match using code:

  DEF [C] (desired desired: manifest [C]) {FIF inappropriate [X] (C: X) (vested M: manifest [X]): option [C] = {DEF HARGS = desired. Typeergugge.zip (M.typeArguments) .forall {case (desired, actual) = & gt; Desired>: & gt; Actual} if (desired> gt;: & gt; m & amp; amp; amp; amp; amp ;; & amp; ;; similar; some) (c.asInstanceOf [C]) nobody else}}   

This code can be used to match those types, it usually erases. Example:

  val IntList = new def [list] [list] (1,2,3,4) Match {Case Intlist (L) = & gt; L (1); Case _ = & gt; -1}   

instead of:

  list (1,2,3,4) match {case l: list [int] = & gt; L (1); Case _ = & gt; -1} // IT has been erased!   

But I have a problem with type system:

  attribute mitrate [t] {type myInt = int val boxoffient = new def [some [mynt ]] / / No problem type MyType = T wall box of myayep = new def [some [mytype]] // could not be found ....}   

The result of that problem:

  The value for the desired parameter could not be found: Manifest [some [mitrate. MyType]] [INFO] val boxoffmery type = new def [some [mytype]] [INFO] ^   

How can I get the required type in the manifest or how do I change this code Can I do so without any errors or warnings?

Thanks for any help

you T manifest is required for the following:

  class MyTrait [T: Manifest] {Type MyType = T Val BoxOfMyType = new Def [Some [MyType]]}   

If you do not really need any special properties and do not have a class, then an option is required. Anyway, by providing any code like clear Type: mitrate [t] {type mitip = t underlying val MyTypeManifest: manifest [t] val boxoffimetepe = new def [some [mytype]]} class x matrate [int] Expands {val MyTypeManifest = manifest [Int]}

Comments