Created
October 8, 2017 01:53
-
-
Save pedrofurla/949a20cbf308c2185210840230ec7f76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> :paste | |
// Entering paste mode (ctrl-D to finish) | |
class A[T] { | |
def add(n: Int)( env: T =:= Int = null): Boolean = if(env == null) true else false | |
} | |
val a = new A[Int] | |
a.add(1) // 2 | |
// Exiting paste mode, now interpreting. | |
<pastie>:18: error: missing argument list for method add in class A | |
Unapplied methods are only converted to functions when a function type is expected. | |
You can make this conversion explicit by writing `add _` or `add(_)(_)` instead of `add`. | |
a.add(1) // 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment