Skip to content

Commit d6e8432

Browse files
committed
Widen singleton types when computing implicit scope
1 parent 4f5a7f7 commit d6e8432

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,8 @@ trait ImplicitRunInfo { self: Run =>
483483
* - If `tp` is a reference `p.T` to a class or opaque type alias, S also contains all object references
484484
* on the prefix path `p`. Under Scala-2 mode, package objects of package references on `p` also
485485
* count towards the implicit scope.
486-
* - If `tp` is an alias of `tp'`, S contains the implicit scope of `tp'`.
486+
* - If `tp` is a (non-opaque) alias of `tp'`, S contains the implicit scope of `tp'`.
487+
* - If `tp` is a singleton type, S contains the implicit scope of its underlying type.
487488
* - If `tp` is some other type, its implicit scope is the union of the implicit scopes of
488489
* its parts (parts defined as in the spec).
489490
*
@@ -520,7 +521,7 @@ trait ImplicitRunInfo { self: Run =>
520521
override implicit protected val ctx: Context = liftingCtx
521522
override def stopAtStatic = true
522523

523-
def apply(tp: Type) = tp match {
524+
def apply(tp: Type) = tp.widenDealias match {
524525
case tp: TypeRef =>
525526
((defn.AnyType: Type) /: anchors(tp))(AndType.make(_, _))
526527
case tp: TypeVar =>
@@ -577,7 +578,7 @@ trait ImplicitRunInfo { self: Run =>
577578
}
578579
case _ =>
579580
}
580-
tp.dealias match {
581+
tp.widenDealias match {
581582
case tp: TypeRef =>
582583
val sym = tp.symbol
583584
if (isAnchor(sym)) {

0 commit comments

Comments
 (0)