此代码仅适用于 SBT 0.7.x 系列(本例中为 0.7.7),但不适用于 SBT 0.11.x 系列(本例中为 0.11.3)。在这两种情况下,使用相同的 Scala 2.9.x 系列 (2.9.1)
似乎 SBT 0.11.3 无法推断参数的类型。Eclipse 也不能。我的猜测是编码中存在问题。还是 SBT 回归?
(目前,我正在使用带有“不稳定”版本的 Scala 插件的 Eclipse 4.2。但是,使用 Eclipse 3.7 和“稳定”版本的插件时,我遇到了同样的错误。)
// either using the "override" reserved keyword or not, this code will compile with SBT 0.7.7 but not with 11.3
sealed trait FacetJoin[T1, T1S, T2S] {
def facetJoin (a: T1S, b: T1S
, fVals: (T1, T1) => T2S
, fFacets: (Formula, T1S, T1S, Formula, T1S, T1S) => T2S
, fBothL: (T1S, Formula, T1S, T1S) => T2S
, fBothR: (Formula, T1S, T1S, T1S) => T2S
, fOther: (T1S, T1S) => T2S): T2S
}
object FacetJoin {
implicit object BoolBoolFacetJoin
extends FacetJoin[Boolean, Formula, Formula] {
// Eclipse complaint for next line:
//// Multiple markers at this line
//// - only classes can have declared but undefined
//// members
//// - ':' expected but ',' found.
override def facetJoin (a, b, fVals, fFacets, fBothL, fBothR, fOther): Formula = {
...
// Eclipse complaint for next line:
//// Multiple markers at this line
//// - identifier expected but '}'
//// found.
//// - not found: type <error>
}
}
}
}