Skip to content

Commit

Permalink
use -Wconf to silence warnings about non-exhaustive pattern matching …
Browse files Browse the repository at this point in the history
…in documentation
  • Loading branch information
mlachkar committed Oct 12, 2020
1 parent 3461fb5 commit 4f6ca02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ lazy val docs = project
skip in publish := true,
moduleName := "scalafix-docs",
scalaVersion := scala213,
scalacOptions += "-Wconf:msg='match may not be exhaustive':ws", // silence exhaustive pattern matching warning for documentation
mdoc := run.in(Compile).evaluated,
crossScalaVersions := List(scala213),
libraryDependencies ++= List(
Expand Down
4 changes: 2 additions & 2 deletions docs/developers/semantic-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Use `MethodSignature.returnType` to get the types of vals.

```scala mdoc
def getType(symbol: Symbol): SemanticType =
(symbol.info.get.signature: @unchecked) match {
symbol.info.get.signature match {
case MethodSignature(_, _, returnType) =>
returnType
}
Expand Down Expand Up @@ -167,7 +167,7 @@ def simpleDealias(tpe: SemanticType): SemanticType = {
case _ =>
symbol
}
(tpe: @unchecked) match {
tpe match {
case TypeRef(prefix, symbol, typeArguments) =>
TypeRef(prefix, dealiasSymbol(symbol), typeArguments.map(simpleDealias))
}
Expand Down
14 changes: 7 additions & 7 deletions docs/developers/symbol-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Use `MethodSignature.returnType` to inspect the return type of a method.

```scala mdoc
def printReturnType(symbol: Symbol): Unit = {
(symbol.info.get.signature: @unchecked) match {
symbol.info.get.signature match {
case signature @ MethodSignature(_, _, returnType) =>
println("returnType = " + returnType)
println("signature = " + signature)
Expand Down Expand Up @@ -104,7 +104,7 @@ Use `MethodSignature.parameterLists` to look up parameters of a method.

```scala mdoc
def printMethodParameters(symbol: Symbol): Unit = {
(symbol.info.get.signature: @unchecked) match {
symbol.info.get.signature match {
case signature @ MethodSignature(typeParameters, parameterLists, _) =>
if (typeParameters.nonEmpty) {
println("typeParameters")
Expand Down Expand Up @@ -151,7 +151,7 @@ Nullary method signatures are distinguished by having an no parameter lists:

```scala mdoc
def printParameterList(symbol: Symbol): Unit = {
(symbol.info.get.signature: @unchecked) match {
symbol.info.get.signature match {
case MethodSignature(_, parameterLists, _) =>
println(parameterLists)
}
Expand Down Expand Up @@ -189,7 +189,7 @@ Use `TypeSignature` to inspect type aliases.

```scala mdoc
def printTypeAlias(symbol: Symbol): Unit = {
(symbol.info.get.signature: @unchecked) match {
symbol.info.get.signature match {
case signature @ TypeSignature(typeParameters, lowerBound, upperBound) =>
if (lowerBound == upperBound) {
println("Type alias where upperBound == lowerBound")
Expand Down Expand Up @@ -236,7 +236,7 @@ Use `ClassSignature.parents` and `TypeRef.symbol` to lookup the class hierarchy.

```scala mdoc
def getParentSymbols(symbol: Symbol): Set[Symbol] =
(symbol.info.get.signature: @unchecked) match {
symbol.info.get.signature match {
case ClassSignature(_, parents, _, _) =>
Set(symbol) ++ parents.collect {
case TypeRef(_, symbol, _) => getParentSymbols(symbol)
Expand Down Expand Up @@ -347,7 +347,7 @@ Use the primary constructor to get the names of the case class fields
```scala mdoc
getConstructors(Symbol("example/User#")).foreach {
case ctor if ctor.isPrimary =>
(ctor.signature: @unchecked) match {
ctor.signature match {
case MethodSignature(_, parameters :: _, _) =>
val names = parameters.map(_.displayName)
println("names: " + names.mkString(", "))
Expand All @@ -362,7 +362,7 @@ Use `SymbolInformation.{isMethod,displayName}` to query for overloaded methods.

```scala mdoc
def getMethodOverloads(classSymbol: Symbol, methodName: String): Set[SymbolInformation] =
(classSymbol.info.get.signature: @unchecked) match {
classSymbol.info.get.signature match {
case ClassSignature(_, parents, _, declarations) =>
val overloadedMethods = declarations.filter { declaration =>
declaration.isMethod &&
Expand Down

0 comments on commit 4f6ca02

Please sign in to comment.