File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -190,8 +190,12 @@ object Checking {
190
190
case tref : TypeRef =>
191
191
val cls = tref.symbol
192
192
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)
195
199
}
196
200
if ! cls.is(Module ) then
197
201
// Create a synthetic singleton type instance, and check whether
You can’t perform that action at this time.
0 commit comments