bug729.scala

来自「JAVA 语言的函数式编程扩展」· SCALA 代码 · 共 24 行

SCALA
24
字号
trait Parser {  type Node <: NodeImpl;  implicit def coerce(n : NodeImpl) = n.self;  trait NodeImpl {    def self : Node;  }  trait Link {    def from : NodeImpl;  }}trait ScalaParserAutoEdit extends Parser {  type Node <: NodeImpl;  implicit def coerce(node : NodeImpl) = node.self;  trait NodeImpl extends super[Parser].NodeImpl {    def self : Node;    def foo = {      var link : Link = null;      val xxx : NodeImpl = coerce(link.from);      val yyy : NodeImpl = link.from;    }  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?