scala - Type mismatch; result.type (with underlying type T) with -Xstrict-inference compiler option -
i'm trying enrich scala.util.try
type fold method. have following implicit that:
implicit class foldabletry[t](tryable: try[t]) { def fold[x](failure: throwable => x)(success: t => x): x = { tryable match { case success(result) => success(result) case failure(ex) => failure(ex) } } }
when run sbt compile -xstrict-inference compiler option, following error:
type mismatch; [error] found : result.type (with underlying type t) [error] required: t [error] case success(result) => success(result) [error] ^ [error] 1 error found [error] (compile:compile) compilation failed
how can fix error? if remove compiler flag compiles.
it looks you're running bug (si-6680). recommend against using -xstrict-inference sounds experimental—notice paul phillip's comment:
-xstrict-inference intended coarse hacky start, kind of coincided departure. expect overflowing implementation issues.
Comments
Post a Comment