Skip to content

Commit 8c77860

Browse files
committed
Widen singleton types when computing implicit scope
1 parent 2a6ea6a commit 8c77860

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ trait ImplicitRunInfo { self: Run =>
486486
* Under Scala-2 mode, package objects of package references on `p` also count
487487
* towards the implicit scope.
488488
* - If `tp` is a (non-opaque) alias of `tp'`, S contains the implicit scope of `tp'`.
489+
* - If `tp` is a singleton type, S contains the implicit scope of its underlying type.
489490
* - If `tp` is some other type, its implicit scope is the union of the implicit scopes of
490491
* its parts (parts defined as in the spec).
491492
*
@@ -523,7 +524,7 @@ trait ImplicitRunInfo { self: Run =>
523524
override implicit protected val ctx: Context = liftingCtx
524525
override def stopAtStatic = true
525526

526-
def apply(tp: Type) = tp match {
527+
def apply(tp: Type) = tp.widenDealias match {
527528
case tp: TypeRef =>
528529
((defn.AnyType: Type) /: anchors(tp))(AndType.make(_, _))
529530
case tp: TypeVar =>
@@ -580,7 +581,7 @@ trait ImplicitRunInfo { self: Run =>
580581
}
581582
case _ =>
582583
}
583-
tp.dealias match {
584+
tp.widenDealias match {
584585
case tp: TypeRef =>
585586
val sym = tp.symbol
586587
if (isAnchor(sym)) {

0 commit comments

Comments
 (0)