Scala 比较提示语法错误

Scala 比较提示语法错误,scala,Scala,对于以下代码,x列表(x) 案例y::ys=> if(x零) 案例x::xs1=>insert(x,isort(xs1)) } } 如果使用排序,而不是可比,则可以导入必要的隐含项以启用List(x) 案例y::ys=> if(x零) 案例x::xs1=>insert(x,isort(xs1)) } } 如果使用排序,而不是可比,则可以导入必要的隐含项以启用List(x) 案例y::ys=> if(x零) 案例x::xs1=>insert(x,isort(xs1)) } } x和y属于T类型,但

对于以下代码,
x列表(x)
案例y::ys=>
if(x零)
案例x::xs1=>insert(x,isort(xs1))
}
}

如果使用
排序
,而不是
可比
,则可以
导入必要的隐含项以启用
List(x)
案例y::ys=>
if(x零)
案例x::xs1=>insert(x,isort(xs1))
}
}

如果使用
排序
,而不是
可比
,则可以
导入必要的隐含项以启用
List(x)
案例y::ys=>
if(x零)
案例x::xs1=>insert(x,isort(xs1))
}
}

x
y
属于
T
类型,但没有任何东西表明
T
具有
x
y
属于
T
类型,但没有任何东西表明
T
具有

class SortAlgo {
def insert[T](x:T, xs:List[T]): List[T]= xs match{
  case Nil=> List(x)
  case y::ys=>
    if(x<y) x::xs
    else y::insert(x,ys)
}

def isort[T:Comparable](xs:List[T]): List[T]=xs match{

   case Nil => Nil
   case x :: xs1 => insert(x, isort(xs1))
}

}
import Ordering.Implicits._
class SortAlgo[T: Ordering] {
  def insert(x:T, xs:List[T]): List[T]= xs match {
    case Nil=> List(x)
    case y::ys=>
      if(x<y) x::xs
      else y::insert(x,ys)
  }

  def isort(xs:List[T]): List[T]=xs match {
    case Nil => Nil
    case x :: xs1 => insert(x, isort(xs1))
  }
}
def insert[T <: Ordered[T]](x:T, xs:List[T]): List[T] = ...
def insert[T](x: T, xs: List[T])(ordering: Ordering[T]): List[T] = {
  case Nil => List(x)
  case y::ys =>
    if (ordering.compare(x, y) < 0) => x::xs
    else y::insert(x, ys)
}