Last active
April 6, 2017 03:48
-
-
Save johntbush/6b99ec7577c559a32e27c6bbbba6d2c3 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
def p(implicit i:Int) = print(i) | |
implicit val v=2 | |
p | |
p(1) | |
//legal | |
def pp(a:Int)(implicit i:Int) = println(a,i) | |
def pp(a:Int)(implicit i:Int, b:Long) = println(a,i,b) | |
def pp(implicit i:Int, b:Long) = println(i,b) | |
// illegal | |
def pp(implicit i:Int, a:Int)(b:Int) = println(a,i) | |
def pp(implicit j:Int, a:Int)(implicit i:Int,b:Int) = println(a,i) | |
def pp(a:Int, implicit i:Int) = println(i,j) | |
def test1(implicit y: Int) = 1 + y | |
def test2(x:Int)(implicit y: Int) = y + test1(x) | |
def test3(x: Int) = x + test2(x) | |
implicit val start = 1 | |
test3(5) | |
test1(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment