Skip to content

Commit 256b82e

Browse files
nicolasstuckicheeseng
authored andcommitted
Do not use IsMethodType outside pattern
1 parent 8d010d1 commit 256b82e

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

scalactic.dotty/src/main/scala/org/scalactic/BooleanMacro.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ object BooleanMacro {
4343

4444
def exprStr: String = condition.show
4545
def defaultCase = '{ Bool.simpleMacroBool($condition, ${Expr(exprStr)}, $prettifier) }
46-
def isImplicitMethodType(tp: Type): Boolean =
47-
IsMethodType.unapply(tp).flatMap(tp => if tp.isImplicit then Some(true) else None).nonEmpty
46+
def isImplicitMethodType(tp: Type): Boolean = tp match {
47+
case IsMethodType(tp) => tp.isImplicit
48+
case _ => false
49+
}
4850

4951
def isByNameMethodType(tp: Type): Boolean = tp.widen match {
5052
case MethodType(_, ByNameType(_) :: Nil, _) => true

scalatest.dotty/src/main/scala/org/scalatest/diagrams/DiagramsMacro.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ object DiagramsMacro {
3232

3333
def isXmlSugar(apply: Apply): Boolean = apply.tpe <:< typeOf[scala.xml.Elem]
3434
def isJavaStatic(tree: Tree): Boolean = tree.symbol.flags.is(Flags.Static)
35-
def isImplicitMethodType(tp: Type): Boolean =
36-
IsMethodType.unapply(tp).flatMap(tp => if tp.isImplicit then Some(true) else None).nonEmpty
35+
def isImplicitMethodType(tp: Type): Boolean = tp match {
36+
case IsMethodType(tp) => tp.isImplicit
37+
case _ => false
38+
}
3739

3840
def selectField(o: Term, name: String): Term = Select.unique(o, name)
3941

0 commit comments

Comments
 (0)