diff --git a/scripts/run-tut.sh b/scripts/run-tut.sh index ad51ea6260..17a6299e03 100755 --- a/scripts/run-tut.sh +++ b/scripts/run-tut.sh @@ -2,5 +2,4 @@ COURSIER_CLASSPATH="$(./coursier fetch -p com.chuusai:shapeless_2.11:2.3.1 org.scala-lang.modules::scala-xml:1.0.3)" -./coursier launch -r "https://dl.bintray.com/tpolecat/maven/" org.tpolecat:tut-core_2.11:0.4.4 -- . tut-tmp '.*\.md$' -classpath "$COURSIER_CLASSPATH" - +./coursier launch -r "https://dl.bintray.com/tpolecat/maven/" org.tpolecat:tut-core_2.11:0.4.4 -- . tut-tmp '.*\.md$' -classpath "$COURSIER_CLASSPATH" -Xfatal-warnings -feature diff --git a/tutorials/tour/implicit-conversions.md b/tutorials/tour/implicit-conversions.md index aa53946c5c..71db42e38a 100644 --- a/tutorials/tour/implicit-conversions.md +++ b/tutorials/tour/implicit-conversions.md @@ -17,7 +17,7 @@ Implicit conversions are applied in two situations: * If an expression `e` is of type `S`, and `S` does not conform to the expression's expected type `T`. * In a selection `e.m` with `e` of type `T`, if the selector `m` does not denote a member of `T`. -In the first case, a conversion `c` is searched for which is applicable to `e` and whose result type conforms to `T`. +In the first case, a conversion `c` is searched for which is applicable to `e` and whose result type conforms to `T`. In the second case, a conversion `c` is searched for which is applicable to `e` and whose result contains a member named `m`. The following operation on the two lists xs and ys of type `List[Int]` is legal: @@ -33,7 +33,7 @@ implicit def list2ordered[A](x: List[A]) (implicit elem2ordered: A => Ordered[A]): Ordered[List[A]] = new Ordered[List[A]] { /* .. */ } -implicit def int2ordered(x: Int): Ordered[Int] = +implicit def int2ordered(x: Int): Ordered[Int] = new Ordered[Int] { /* .. */ } ``` @@ -42,6 +42,8 @@ The implicitly imported object `scala.Predef` declares several predefined types For example, when calling a Java method that expects a `java.lang.Integer`, you are free to pass it a `scala.Int` instead. That's because Predef includes the following implicit conversions: ```tut +import scala.language.implicitConversions + implicit def int2Integer(x: Int) = java.lang.Integer.valueOf(x) ```