私有 Scala 方法的可见性问题

Visibility issue with a private Scala method

我有以下 Scala 代码片段,是包含更多 类 的更大源文件的一部分,其中包含私有字段、方法和 public 方法:

class Grid {

  private val cells = Vector(
    Vector(new Cell, new Cell, new Cell),
    Vector(new Cell, new Cell, new Cell),
    Vector(new Cell, new Cell, new Cell)
  )



 private def tranpose(grid:Vector[Vector[Cell]]) : Vector[Vector[Cell]] = {
    val newgrid = Vector(
      Vector(grid(0)(0), grid(1)(0), grid(2)(0)),
      Vector(grid(0)(1), grid(1)(1), grid(2)(1)),
      Vector(grid(0)(2), grid(1)(2), grid(2)(2))
      )
    newgrid
     }

  // Determine winner or draw
    def wins(symbol:Char):Boolean  = {
       val fullvec = Vector(symbol, symbol, symbol)
       for(r<-cells)
          if(r.equals(fullvec))
            true

        // Transpose the grid into a new one and make the same check again
        val transpgrid = transpose(cells)
        for(r<-transpgrid)
           if(r.equals(fullvec))
             true

        // Now check diagonals
        val maindiag = Vector(cells(0)(0), cells(1)(1), cells(2)(2))
        val seconddiag = Vector(cells(0)(2), cells(1)(1), cells(2)(0))
        if(maindiag.equals(fullvec) || seconddiag.equals(fullvec)) 
           true
         false
    }

wins 方法内的代码行 val transpgrid = transpose(cells) 中,scala 给我以下消息:

jasonfil@hp ~/AtomicScala/examples $ scala TicTacToe.scala 
TicTacToe.scala:69: error: not found: value transpose
    val transpgrid = transpose(cells)

我曾尝试在 transpose 的调用前添加关键字 this,但我没有成功。我是该语言的新手,并认为我在通话时犯了某种错误。

// 编辑:我已将此 post 标记为版主批准和删除,因为很明显我在创建最小示例(明显的错字)时没有给予足够的重视。但是,从那以后我意识到我的这段代码的另一个错误是 "return" 代码区域中的 "return" 关键字的自由不使用 显然 不是最后一个他们各自的方法行。昨天这让我很心痛,但我从心痛中吸取了教训。

您有一个拼写错误 - private def tranpose 应该是 private def transpose