Skip to content

Commit 2e2558f

Browse files
committed
Fix review comments
1 parent c3c17ef commit 2e2558f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,12 @@ object Checking {
190190
case tref: TypeRef =>
191191
val cls = tref.symbol
192192
if (cls.isOneOf(AbstractOrTrait)) {
193-
val srcCls = srcTp.underlyingClassRef(refinementOK = false).asInstanceOf[TypeRef].symbol
194-
report.error(CantInstantiateAbstractClassOrTrait(srcCls, isTrait = srcCls.is(Trait)), pos)
193+
srcTp.underlyingClassRef(refinementOK = false) match
194+
case tref0: TypeRef =>
195+
val srcCls = tref0.symbol
196+
report.error(CantInstantiateAbstractClassOrTrait(srcCls, isTrait = srcCls.is(Trait)), pos)
197+
case _ =>
198+
report.error(CantInstantiateAbstractClassOrTrait(cls, isTrait = cls.is(Trait)), pos)
195199
}
196200
if !cls.is(Module) then
197201
// Create a synthetic singleton type instance, and check whether

0 commit comments

Comments
 (0)