bug616.scala

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

SCALA
12
字号
object testImplicit {	implicit def foo2bar(foo :Foo) :Bar = foo.bar	class Foo(val bar :Bar) {	    def testCoercion = {val a = this; a.baz} // here, foo2bar is inferred  by the compiler, as expected 	    //def testCoercionThisImplicit = baz  // --> error: not found: value baz	    def testCoercionThisExplicit: Any = this.baz  // --> error: value baz is not a  member of Foo	}	trait Bar { def baz :unit}}// mentioned before: http://thread.gmane.org/gmane.comp.lang.scala/2038,// but couldn't find a bug report

⌨️ 快捷键说明

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