File tree 4 files changed +21
-3
lines changed
compiler/src/dotty/tools/dotc
4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -530,6 +530,7 @@ object Flags {
530
530
531
531
// ------- Other flag sets -------------------------------------
532
532
533
+ val NotConcrete : FlagSet = AbsOverride | Deferred
533
534
val AbstractFinal : FlagSet = Abstract | Final
534
535
val AbstractOverride : FlagSet = Abstract | Override
535
536
val AbstractSealed : FlagSet = Abstract | Sealed
Original file line number Diff line number Diff line change @@ -524,10 +524,10 @@ object RefChecks {
524
524
525
525
def isImplemented (mbr : Symbol ) =
526
526
val mbrType = clazz.thisType.memberInfo(mbr)
527
- extension (sym : Symbol ) def isConcrete = sym.exists && ! sym.is( Deferred )
527
+ def isConcrete (sym : Symbol ) = sym.exists && ! sym.isOneOf( NotConcrete )
528
528
clazz.nonPrivateMembersNamed(mbr.name)
529
529
.filterWithPredicate(
530
- impl => impl.symbol.isConcrete && mbrType.matchesLoosely(impl.info))
530
+ impl => isConcrete( impl.symbol) && mbrType.matchesLoosely(impl.info))
531
531
.exists
532
532
533
533
/** The term symbols in this class and its baseclasses that are
@@ -641,7 +641,11 @@ object RefChecks {
641
641
642
642
undefined(s " \n (Note that ${pa.show} does not match ${pc.show}$addendum) " )
643
643
case xs =>
644
- undefined(s " \n (The class implements a member with a different type: ${concrete.showDcl}) " )
644
+ undefined(
645
+ if concrete.symbol.is(AbsOverride ) then
646
+ s " \n (The class implements ${concrete.showDcl} but that definition still needs an implementation) "
647
+ else
648
+ s " \n (The class implements a member with a different type: ${concrete.showDcl}) " )
645
649
}
646
650
case Nil =>
647
651
undefined(" " )
Original file line number Diff line number Diff line change
1
+ -- Error: tests/neg/i9329.scala:8:6 ------------------------------------------------------------------------------------
2
+ 8 |class GrandSon extends Son // error
3
+ | ^
4
+ | class GrandSon needs to be abstract, since def name: => String is not defined
5
+ | (The class implements abstract override def name: => String but that definition still needs an implementation)
Original file line number Diff line number Diff line change
1
+ trait Parent {
2
+ def name : String
3
+ }
4
+ trait Son extends Parent {
5
+ abstract override def name = " "
6
+ def parentName = super .name
7
+ }
8
+ class GrandSon extends Son // error
You can’t perform that action at this time.
0 commit comments