Skip to content

Commit d957f2c

Browse files
committed
Changed parent reference from type to symbol
1 parent 93ce6d5 commit d957f2c

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,13 +2065,13 @@ object messages {
20652065
hl"An object that contains ${"@static"} members must have a companion class."
20662066
}
20672067

2068-
case class PolymorphicMethodMissingTypeInParent(rsym: Symbol, parentTpt: tpd.Tree)(implicit ctx: Context)
2068+
case class PolymorphicMethodMissingTypeInParent(rsym: Symbol, parentSym: Symbol)(implicit ctx: Context)
20692069
extends Message(PolymorphicMethodMissingTypeInParentID) {
20702070
val kind = "Syntax"
2071-
val msg = hl"polymorphic refinement $rsym without matching type in parent $parentTpt is no longer allowed"
2071+
val msg = hl"polymorphic refinement $rsym without matching type in parent $parentSym is no longer allowed"
20722072
val explanation =
2073-
hl"""Polymorphic $rsym is not allowed in the structural refinement of $parentTpt because
2074-
|$rsym does not override any symbol in $parentTpt. Structural refinement does not allow for
2073+
hl"""Polymorphic $rsym is not allowed in the structural refinement of $parentSym because
2074+
|$rsym does not override any method in $parentSym. Structural refinement does not allow for
20752075
|polymorphic methods."""
20762076
}
20772077
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
11691169
checkRefinementNonCyclic(refinement, refineCls, seen)
11701170
val rsym = refinement.symbol
11711171
if (rsym.info.isInstanceOf[PolyType] && rsym.allOverriddenSymbols.isEmpty)
1172-
ctx.error(PolymorphicMethodMissingTypeInParent(rsym, tpt1), refinement.pos) }
1172+
ctx.error(PolymorphicMethodMissingTypeInParent(rsym, tpt1.symbol), refinement.pos)
1173+
}
11731174
assignType(cpy.RefinedTypeTree(tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
11741175
}
11751176

compiler/test/dotty/tools/dotc/reporting/ErrorMessagesTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,8 +1290,8 @@ class ErrorMessagesTests extends ErrorMessagesTest {
12901290
implicit val ctx: Context = ictx
12911291

12921292
assertMessageCount(1, messages)
1293-
val PolymorphicMethodMissingTypeInParent(rsym, parentTpt) = messages.head
1293+
val PolymorphicMethodMissingTypeInParent(rsym, parentSym) = messages.head
12941294
assertEquals("method get", rsym.show)
1295-
assertEquals("Object", parentTpt.show)
1295+
assertEquals("class Object", parentSym.show)
12961296
}
12971297
}

0 commit comments

Comments
 (0)