Skip to content

Instantly share code, notes, and snippets.

@johntbush
Last active April 6, 2017 03:48
Show Gist options
  • Save johntbush/6b99ec7577c559a32e27c6bbbba6d2c3 to your computer and use it in GitHub Desktop.
Save johntbush/6b99ec7577c559a32e27c6bbbba6d2c3 to your computer and use it in GitHub Desktop.
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