Skip to content

Commit c7e239a

Browse files
committed
address comments
1 parent 1fdea9f commit c7e239a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

_tour/implicit-conversions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ redirect_from: "/tutorials/tour/implicit-conversions.html"
1515
In Scala 2, an implicit conversion from type `S` to type `T` is defined by an [implicit value]({% link _tour/implicit-parameters.md %}) which has function type `S => T`, or by an implicit method convertible to a value of that type.
1616
{% endtab %}
1717
{% tab 'Scala 3' %}
18-
In Scala 3, an implicit conversion from type `S` to type `T` is defined by a [given instance]({% link _tour/implicit-parameters.md %}) which has type `scala.Conversion[S, T]`, or by an implicit method which can be eta-expanded to the function type `S => T`.
18+
In Scala 3, an implicit conversion from type `S` to type `T` is defined by a [given instance]({% link _tour/implicit-parameters.md %}) which has type `scala.Conversion[S, T]`. For compatibility with Scala 2, they can also be defined by an implicit method (read more in the Scala2 tab).
1919
{% endtab %}
2020
{% endtabs %}
2121

@@ -24,14 +24,14 @@ Implicit conversions are applied in two situations:
2424
1. If an expression `e` is of type `S`, and `S` does not conform to the expression's expected type `T`.
2525
2. In a selection `e.m` with `e` of type `S`, if the selector `m` does not denote a member of `S`.
2626

27-
In the first case, a conversion `c` is searched for which is applicable to `e` and whose result type conforms to `T`.
27+
In the first case, a conversion `c` is searched for, which is applicable to `e` and whose result type conforms to `T`.
2828

2929
An example is to pass a `scala.Int`, e.g. `x`, to a method that expects `scala.Long`. In this case, the implicit conversion `Int.int2long(x)` is inserted.
3030

3131

32-
In the second case, a conversion `c` is searched for which is applicable to `e` and whose result contains a member named `m`.
32+
In the second case, a conversion `c` is searched for, which is applicable to `e` and whose result contains a member named `m`.
3333

34-
An example is to compare two strings `"foo" < "bar"`. In this case, `String` has no member `<`, so the implicit conversion `Predef.augmentString("foo") < "bar"` is inserted.
34+
An example is to compare two strings `"foo" < "bar"`. In this case, `String` has no member `<`, so the implicit conversion `Predef.augmentString("foo") < "bar"` is inserted. (`scala.Predef` is automatically imported into all Scala programs.)
3535

3636
**Beware the power of implicit conversions:**
3737

@@ -48,14 +48,14 @@ No warning is emitted when the conversion is applied by the compiler.
4848
{% endtab %}
4949
{% tab 'Scala 3' %}
5050
Because implicit conversions can have pitfalls if used indiscriminately the compiler warns in two situations:
51-
- when compiling the implicit conversion definition (for Scala 2 style conversions).
51+
- when compiling a Scala 2 style implicit conversion definition.
5252
- at the call site where a given instance of `scala.Conversion` is inserted as a conversion.
5353

5454
To turn off the warnings take either of these actions:
5555

5656
- Import `scala.language.implicitConversions` into the scope of:
57-
- the implicit conversion definition (for Scala 2 style conversions)
58-
- the call site (when an inserted conversion was defined by a given instance of `scala.Conversion`)
57+
- a Scala 2 style implicit conversion definition
58+
- call sites where a given instance of `scala.Conversion` is inserted as a conversion.
5959
- Invoke the compiler with `-language:implicitConversions`
6060
{% endtab %}
6161
{% endtabs %}

0 commit comments

Comments
 (0)