Skip to content

Commit 5dec63f

Browse files
committed
Improve docs
1 parent 0bb5301 commit 5dec63f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/docs/reference/other-new-features/type-test.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ val tt: TypeTest[Any, String] =
6868
f[AnyRef, String]("acb")(using tt)
6969
```
7070

71-
The compiler will synthesize a new instance of a type test if non is found in scope as
71+
The compiler will synthesize a new instance of a type test if none is found in scope as:
7272
```scala
7373
new TypeTest[A, B]:
7474
def unapply(s: A): Option[s.type & B] =
@@ -78,8 +78,8 @@ new TypeTest[A, B]:
7878
```
7979
If the type tests cannot be done there will be an unchecked warning that will be raised on the `case s: B =>` test.
8080

81-
The most common `TypeTest` are the ones that take any parameters (i.e. `TypeTest[Any, T]`).
82-
To make it possible to use this directly in context bounds we provide the alias
81+
The most common `TypeTest` instances are the ones that take any parameters (i.e. `TypeTest[Any, T]`).
82+
To make it possible to use such instances directly in context bounds we provide the alias
8383
```scala
8484
package scala.reflect
8585

@@ -99,10 +99,10 @@ f[Int] // fasle
9999
```
100100

101101
### TypeTest and ClassTag
102-
`TypeTest` is a replacemnt for the same functionallity performed by the `ClassTag.unaplly`.
103-
Using `ClassTag` instances happend to be unsound.
104-
`TypeTest` fixes that unsoundess and adds extra flexibility with the `S` type.
105-
`ClassTag` type tests will still be supported but a warining will be emitted after 3.0.
102+
`TypeTest` is a replacement for functionality provided previously by `ClassTag.unapply`.
103+
Using `ClassTag` instances was unsound since classtags can check only the class component of a type.
104+
`TypeTest` fixes that unsoundness.
105+
`ClassTag` type tests are still supported but a warning will be emitted after 3.0.
106106

107107

108108
Examples
@@ -132,7 +132,7 @@ it will be possible to write the following program
132132

133133
```scala
134134
val peano: Peano = ...
135-
import peano.{_, given _}
135+
import peano._
136136
def divOpt(m: Nat, n: Nat): Option[(Nat, Nat)] =
137137
n match
138138
case Zero => None

0 commit comments

Comments
 (0)