Skip to content

Instantly share code, notes, and snippets.

@jorgeortiz85
Created May 7, 2012 00:12
Show Gist options
  • Save jorgeortiz85/2625104 to your computer and use it in GitHub Desktop.
Save jorgeortiz85/2625104 to your computer and use it in GitHub Desktop.
dependent method types
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_31).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class Outer { class Inner }
defined class Outer
scala> trait DepFun { def apply(x: Outer): x.Inner }
defined trait DepFun
scala> new DepFun { override def apply(x: Outer): x.Inner = new x.Inner }
<console>:10: error: overriding method apply in trait DepFun of type (x: Outer)x.Inner;
method apply has incompatible type
new DepFun { override def apply(x: Outer): x.Inner = new x.Inner }
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment