Skip to content

Refine rules for capture parameters and members #22000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Dec 1, 2024
Prev Previous commit
Next Next commit
Clean comments
  • Loading branch information
noti0na1 committed Dec 1, 2024
commit 1ed08dee4a26d6ae1806a6d5368ef0160bbe3a8d
4 changes: 1 addition & 3 deletions compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ object RefChecks {
* This one used to succeed only if forwarding parameters is on.
* (Forwarding tends to hide problems by binding parameter names).
*/

private def upwardsThisType(cls: Symbol)(using Context) = cls.info match {
case ClassInfo(_, _, _, _, tp: Type) if (tp.stripCapturing ne cls.typeRef) && !cls.isOneOf(FinalOrModuleClass) =>
// println(i"upwardsThisType($cls) = ${cls.typeRef}, ne $tp")
SkolemType(cls.appliedRef).withName(nme.this_)
case _ =>
cls.thisType
Expand Down Expand Up @@ -442,7 +440,7 @@ object RefChecks {
val (mtp, otp) = if compareTypes then (memberTp(self), otherTp(self)) else (NoType, NoType)
OverrideError(core, self, member, other, mtp, otp)

def compatTypes(memberTp: Type, otherTp: Type): Boolean = // race.force(i"compatTypes $memberTp <:< $otherTp"):
def compatTypes(memberTp: Type, otherTp: Type): Boolean =
try
isOverridingPair(member, memberTp, other, otherTp,
fallBack = warnOnMigration(
Expand Down