Skip to content

Commit 8de577d

Browse files
committed
Fix typos
1 parent d962d0b commit 8de577d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: "TypeTest"
66
TypeTest
77
--------
88

9-
`TypeTest` provides the a replacement for `ClassTag.unapply` where the type of the argument is generalized.
9+
`TypeTest` provides a replacement for `ClassTag.unapply` where the type of the argument is generalized.
1010
`TypeTest.unapply` will return `Some(x.asInstanceOf[Y])` if `x` conforms to `Y`, otherwise it returns `None`.
1111

1212
```scala
@@ -15,7 +15,7 @@ trait TypeTest[-S, T] extends Serializable {
1515
}
1616
```
1717

18-
Just like `ClassTag` used to to, it can be used to perform type checks in patterns.
18+
Just like `ClassTag` used to do, it can be used to perform type checks in patterns.
1919

2020
```scala
2121
type X

library/src/scala/reflect/TypeTest.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
package scala.reflect
22

33
/** A `TypeTest[S, T] contains the logic needed to know at runtime if a value of
4-
* type `S` can be downcased to `T`.
4+
* type `S` can be downcasted to `T`.
55
*
66
* If a pattern match is performed on a term of type `s: S` that is uncheckable with `s.isInstanceOf[T]` and
77
* the pattern are of the form:
88
* - `t: T`
99
* - `t @ X()` where the `X.unapply` has takes an argument of type `T`
10-
* then a given instance of `TypeTest[S, T]` is summoned and used to performed the test.
11-
*
12-
* Note: This is replacemet for `ClassTag.unapply` that can be sound for path dependent types
10+
* then a given instance of `TypeTest[S, T]` is summoned and used to perform the test.
1311
*/
1412
@scala.annotation.implicitNotFound(msg = "No TypeTest available for [${S}, ${T}]")
1513
trait TypeTest[-S, T] extends Serializable {
1614

1715
/** A TypeTest[S, T] can serve as an extractor that matches only S of type T.
1816
*
1917
* The compiler tries to turn unchecked type tests in pattern matches into checked ones
20-
* by wrapping a `(_: T)` type pattern as `tt(_: T)`, where `ct` is the `TypeTest[S, T]` instance.
18+
* by wrapping a `(_: T)` type pattern as `tt(_: T)`, where `tt` is the `TypeTest[S, T]` instance.
2119
* Type tests necessary before calling other extractors are treated similarly.
2220
* `SomeExtractor(...)` is turned into `tt(SomeExtractor(...))` if `T` in `SomeExtractor.unapply(x: T)`
2321
* is uncheckable, but we have an instance of `TypeTest[S, T]`.

0 commit comments

Comments
 (0)