Skip to content

fix some typo in TypeTest doc #12992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions library/src/scala/reflect/TypeTest.scala
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package scala.reflect

/** A `TypeTest[S, T] contains the logic needed to know at runtime if a value of
/** A `TypeTest[S, T]` contains the logic needed to know at runtime if a value of
* type `S` is an instance of `T`.
*
* If a pattern match is performed on a term of type `s: S` that is uncheckable with `s.isInstanceOf[T]` and
* the pattern are of the form:
* the pattern is one of the following forms:
* - `t: T`
* - `t @ X()` where the `X.unapply` has takes an argument of type `T`
* - `t @ X()` where `X.unapply` takes an argument of type `T`
* then a given instance of `TypeTest[S, T]` is summoned and used to perform the test.
*/
@scala.annotation.implicitNotFound(msg = "No TypeTest available for [${S}, ${T}]")
trait TypeTest[-S, T] extends Serializable:

/** A TypeTest[S, T] can serve as an extractor that matches if and only if S of type T.
/** A `TypeTest[S, T]` can serve as an extractor that matches if and only if a value of type `S` is
* an instance of `T`.
*
* The compiler tries to turn unchecked type tests in pattern matches into checked ones
* by wrapping a `(_: T)` type pattern as `tt(_: T)`, where `tt` is the `TypeTest[S, T]` instance.
Expand Down