Skip to content

Commit 221e5d1

Browse files
committed
Never include self types in named parts of a type
According to SLS § 7.2, self types are not a named part of a type, so they're not part of the implicit scope. Before this commit, this was usually the case because we normally refer to a class using a TypeRef, but in some cases a class might appear as a ThisType, and ThisType#underlying returns the self type, we now use ThisType#tref instead which just returns a TypeRef corresponding to the class.
1 parent 088902c commit 221e5d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3450,7 +3450,7 @@ object Types {
34503450
case TypeBounds(_, hi) =>
34513451
apply(x, hi)
34523452
case tp: ThisType =>
3453-
apply(x, tp.underlying)
3453+
apply(x, tp.tref)
34543454
case tp: ConstantType =>
34553455
apply(x, tp.underlying)
34563456
case tp: MethodParam =>

0 commit comments

Comments
 (0)