Skip to content

Commit c6076a0

Browse files
committed
Polishings
1 parent 23e64a3 commit c6076a0

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {
9393
def _isInstanceOf(b: Symbol, tp: Type): Tree
9494
/* tgt is expected to be a Seq, call tgt.drop(n) */
9595
def drop(tgt: Tree)(n: Int): Tree
96-
/* tgt is expected to have method apply(int), call tgt.drop(i) */
96+
/* tgt is expected to have method apply(int), call tgt.apply(i) */
9797
def index(tgt: Tree)(i: Int): Tree
9898
/* make tree that accesses the i'th component of the tuple referenced by binder */
9999
def tupleSel(binder: Symbol)(i: Int): Tree

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@ import reporting.diagnostic.Message
3333
object Applications {
3434
import tpd._
3535

36-
def extractorMember(tp: Type, name: Name)(implicit ctx: Context) = {
37-
def isPossibleExtractorType(tp: Type) = tp match {
38-
case _: MethodOrPoly => false
39-
case _ => true
40-
}
41-
tp.member(name).suchThat(d => isPossibleExtractorType(d.info))
42-
}
36+
def extractorMember(tp: Type, name: Name)(implicit ctx: Context) =
37+
tp.member(name).suchThat(_.info.isParameterless)
4338

4439
def extractorMemberType(tp: Type, name: Name, errorPos: Position = NoPosition)(implicit ctx: Context) = {
4540
val ref = extractorMember(tp, name)
@@ -72,7 +67,8 @@ object Applications {
7267
if (defn.isProductSubType(tp)) productSelectorTypes(tp).size else -1
7368

7469
def productSelectors(tp: Type)(implicit ctx: Context): List[Symbol] = {
75-
val sels = for (n <- Iterator.from(0)) yield tp.member(nme.selectorName(n)).symbol
70+
val sels = for (n <- Iterator.from(0)) yield
71+
tp.member(nme.selectorName(n)).suchThat(_.info.isParameterless).symbol
7672
sels.takeWhile(_.exists).toList
7773
}
7874

0 commit comments

Comments
 (0)