相关疑难解决方法(0)

Scala中的模式匹配结构类型

为什么打印wtf?模式匹配不适用于结构类型吗?

  "hello" match {
    case s: { def doesNotExist(i: Int, x: List[_]): Double } => println("wtf?")
    case _ => println("okie dokie")
  }
Run Code Online (Sandbox Code Playgroud)

scala pattern-matching structural-typing

21
推荐指数
2
解决办法
3807
查看次数