Function case类的scala返回case不匹配

Function case类的scala返回case不匹配,function,scala,return,case-class,mismatch,Function,Scala,Return,Case Class,Mismatch,我假设返回一个名为Entry的case类,因此无法更改函数的签名。当我填写case类并尝试返回它时,出现以下错误: <console>:13: error: type mismatch; found : Entry(in method apply) required: <empty>.Entry 这是一个猜测,但我相信条目是在别处定义的。我这样说是因为在函数签名中有一个对“Entry”类的引用,但在函数体中也定义了一个case类。返回的条目不是函数期望的条目。谢

我假设返回一个名为Entry的case类,因此无法更改函数的签名。当我填写case类并尝试返回它时,出现以下错误:

<console>:13: error: type mismatch;
 found   : Entry(in method apply)
 required: <empty>.Entry

这是一个猜测,但我相信
条目
是在别处定义的。我这样说是因为在函数签名中有一个对“Entry”类的引用,但在函数体中也定义了一个case类。返回的
条目
不是函数期望的
条目

谢谢,这是问题所在。
def apply(line: String) : Entry = {
   case class Entry(account:String, password:String, UID:Int, GID:Int,
                    GECOS:String, directory:String, shell:String)
   val fields = line.split(":")
   val x = Entry(fields(0), fields(1), fields(2).toInt, fields(3).toInt,
         fields(4), fields(5), fields(6))
    x
}