Skip to content

Commit 474b35f

Browse files
oderskygzm0
authored andcommitted
Fix of t1123 - Unit discarding
Need to do unit discarding also in selection prototypes.
1 parent 0a1ec31 commit 474b35f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ object ProtoTypes {
7979
override def isMatchedBy(tp1: Type)(implicit ctx: Context) = {
8080
name == nme.WILDCARD || {
8181
val mbr = tp1.member(name)
82-
def qualifies(m: SingleDenotation) = compat.normalizedCompatible(m.info, memberProto)
82+
def qualifies(m: SingleDenotation) =
83+
memberProto.isRef(defn.UnitClass) ||
84+
compat.normalizedCompatible(m.info, memberProto)
8385
mbr match { // hasAltWith inlined for performance
8486
case mbr: SingleDenotation => mbr.exists && qualifies(mbr)
8587
case _ => mbr hasAltWith qualifies

tests/untried/pos/t1123.scala renamed to tests/pos/t1123.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ object Test {
77
}
88
def f = extraListener.h
99
}
10-
def main(args : Array[String]) : Unit = (new Editor).f
10+
def main(args : Array[String]): Unit = (new Editor).f
1111
}

0 commit comments

Comments
 (0)