Skip to content

Commit 03ec379

Browse files
committed
Fix of intersection not empty
The bug caused new version of FirstTransform to compile with errors.
1 parent 5733684 commit 03ec379

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ object RefChecks {
222222
}
223223

224224
/* Is the intersection between given two lists of overridden symbols empty? */
225-
def intersectionIsEmpty(syms1: Iterator[Symbol], syms2: Iterator[Symbol]) =
226-
!(syms1 exists (syms2 contains _))
225+
def intersectionIsEmpty(syms1: Iterator[Symbol], syms2: Iterator[Symbol]) = {
226+
val set2 = syms2.toSet
227+
!(syms1 exists (set2 contains _))
228+
}
227229

228230
// o: public | protected | package-protected (aka java's default access)
229231
// ^-may be overridden by member with access privileges-v
@@ -274,6 +276,8 @@ object RefChecks {
274276
!(member.owner.thisType.baseClasses exists (_ isSubClass other.owner)) &&
275277
!member.is(Deferred) && !other.is(Deferred) &&
276278
intersectionIsEmpty(member.extendedOverriddenSymbols, other.extendedOverriddenSymbols)) {
279+
println(i"${member.extendedOverriddenSymbols.toList.map(_.showLocated)}%, %")
280+
println(i"${other.extendedOverriddenSymbols.toList.map(_.showLocated)}%, %")
277281
overrideError("cannot override a concrete member without a third member that's overridden by both " +
278282
"(this rule is designed to prevent ``accidental overrides'')")
279283
} else if (other.isStable && !member.isStable) { // (1.4)

0 commit comments

Comments
 (0)