Skip to content

Commit d9d9280

Browse files
committed
Revert hasAltWith changes
1 parent b5e4e33 commit d9d9280

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,7 @@ object Denotations {
257257
def checkUnique(using Context): SingleDenotation = suchThat(alwaysTrue)
258258

259259
/** Does this denotation have an alternative that satisfies the predicate `p`? */
260-
inline def hasAltWith(inline p: SingleDenotation => Boolean): Boolean =
261-
def p1(x: SingleDenotation) = p(x)
262-
this match
263-
case d: SingleDenotation => exists && p1(d)
264-
case _ => filterWithPredicate(p1).exists
260+
def hasAltWith(p: SingleDenotation => Boolean): Boolean
265261

266262
/** The denotation made up from the alternatives of this denotation that
267263
* are accessible from prefix `pre`, or NoDenotation if no accessible alternative exists.
@@ -608,6 +604,9 @@ object Denotations {
608604
def suchThat(p: Symbol => Boolean)(using Context): SingleDenotation =
609605
if (exists && p(symbol)) this else NoDenotation
610606

607+
def hasAltWith(p: SingleDenotation => Boolean): Boolean =
608+
exists && p(this)
609+
611610
def accessibleFrom(pre: Type, superAccess: Boolean)(using Context): Denotation =
612611
if (!symbol.exists || symbol.isAccessibleFrom(pre, superAccess)) this else NoDenotation
613612

@@ -1186,6 +1185,8 @@ object Denotations {
11861185
}
11871186
override def filterWithPredicate(p: SingleDenotation => Boolean): Denotation =
11881187
derivedUnionDenotation(denot1.filterWithPredicate(p), denot2.filterWithPredicate(p))
1188+
def hasAltWith(p: SingleDenotation => Boolean): Boolean =
1189+
denot1.hasAltWith(p) || denot2.hasAltWith(p)
11891190
def accessibleFrom(pre: Type, superAccess: Boolean)(using Context): Denotation = {
11901191
val d1 = denot1 accessibleFrom (pre, superAccess)
11911192
val d2 = denot2 accessibleFrom (pre, superAccess)

0 commit comments

Comments
 (0)