Skip to content

Commit 57b5311

Browse files
committed
SAMtype extractor should not use avoidance in same class
When extracting a SAMtype we use avoidance of the class parameters since these are not visible outside the class. But we should not do that when the SAMType is extracted with an owner within the class. Fixes a problem with sammy_scope.scala that was left dormant until now since RefChecks did not check methods generated by ExpandSAMs.
1 parent 41aa184 commit 57b5311

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5006,7 +5006,9 @@ object Types {
50065006
mapOver(tp)
50075007
}
50085008
}
5009-
val approx = approxParams(mt).asInstanceOf[MethodType]
5009+
val approx =
5010+
if ctx.owner.isContainedIn(cls) then mt
5011+
else approxParams(mt).asInstanceOf[MethodType]
50105012
Some(approx)
50115013
case _ =>
50125014
None

0 commit comments

Comments
 (0)