summaryrefslogtreecommitdiff
path: root/spec/04-basic-declarations-and-definitions.md
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2017-03-09 02:25:55 -0800
committerSom Snytt <som.snytt@gmail.com>2017-03-10 02:58:17 -0800
commitdea2171a1c0f948a3b81cbd2195d99b2fb1b2e5d (patch)
tree0d63ba884aec32fd7ce58496efb839a63d9ddfde /spec/04-basic-declarations-and-definitions.md
parentc309f9867a557d4edccaebfa399eabcef11bf1bf (diff)
downloadscala-dea2171a1c0f948a3b81cbd2195d99b2fb1b2e5d.tar.gz
scala-dea2171a1c0f948a3b81cbd2195d99b2fb1b2e5d.tar.bz2
scala-dea2171a1c0f948a3b81cbd2195d99b2fb1b2e5d.zip
SI-5621 Missing implicits are supplied by defaults
Make a note in the examples for default args.
Diffstat (limited to 'spec/04-basic-declarations-and-definitions.md')
-rw-r--r--spec/04-basic-declarations-and-definitions.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/04-basic-declarations-and-definitions.md b/spec/04-basic-declarations-and-definitions.md
index 53b34dedc5..c4d3425fff 100644
--- a/spec/04-basic-declarations-and-definitions.md
+++ b/spec/04-basic-declarations-and-definitions.md
@@ -669,6 +669,15 @@ def f(a: Int = 0)(b: Int = a + 1) = b // OK
f(10)() // returns 11 (not 1)
```
+If an [implicit argument](07-implicits.html#implicit-parameters)
+is not found by implicit search, it may be supplied using a default argument.
+
+```scala
+implicit val i: Int = 2
+def f(implicit x: Int, s: String = "hi") = s * x
+f // "hihi"
+```
+
### By-Name Parameters
```ebnf