File tree Expand file tree Collapse file tree 10 files changed +29
-11
lines changed 
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 10 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -311,6 +311,15 @@ object RefChecks {
311311
312312    val  mixinOverrideErrors  =  new  mutable.ListBuffer [MixinOverrideError ]()
313313
314+     /**  Returns a `SourcePosition` containing the full span (with the correct 
315+      *  end) of the class name. */  
316+     def  clazzNamePos  = 
317+       if  clazz.name ==  tpnme.ANON_CLASS  then 
318+         clazz.srcPos
319+       else 
320+         val  clazzNameEnd  =  clazz.srcPos.span.start +  clazz.name.stripModuleClassSuffix.lastPart.length
321+         clazz.srcPos.sourcePos.copy(span =  clazz.srcPos.span.withEnd(clazzNameEnd))
322+ 
314323    def  printMixinOverrideErrors ():  Unit  = 
315324      mixinOverrideErrors.toList match  {
316325        case  Nil  => 
@@ -843,7 +852,7 @@ object RefChecks {
843852        checkNoAbstractDecls(clazz)
844853
845854      if  (abstractErrors.nonEmpty)
846-         report.error(abstractErrorMessage, clazz.srcPos )
855+         report.error(abstractErrorMessage, clazzNamePos )
847856
848857      checkMemberTypesOK()
849858      checkCaseClassInheritanceInvariant()
Original file line number Diff line number Diff line change 11-- Error: tests/neg/i10666.scala:8:6 -----------------------------------------------------------------------------------
228 |class Bar extends Foo { // error
3-   |      ^
3+   |      ^^^ 
44  |      class Bar needs to be abstract, since def foo[T <: B](tx: T): Unit in trait Foo is not defined 
55  |      (Note that
66  |       parameter T in def foo[T <: B](tx: T): Unit in trait Foo does not match
Original file line number Diff line number Diff line change 11-- Error: tests/neg/i12828.scala:7:7 -----------------------------------------------------------------------------------
227 |object Baz extends Bar[Int] // error: not implemented
3-   |       ^
3+   |       ^^^ 
44  |       object creation impossible, since def foo(x: A): Unit in trait Foo is not defined 
55  |       (Note that
66  |        parameter A in def foo(x: A): Unit in trait Foo does not match
Original file line number Diff line number Diff line change 11-- Error: tests/neg/i13466.scala:9:6 -----------------------------------------------------------------------------------
229 |given none: SomeTrait[Finally] with {} // error
3-   |      ^
3+   |      ^^^^ 
44  |      object creation impossible, since:
55  |      it has 3 unimplemented members.
66  |      /** As seen from module class none$, the missing signatures are as follows.
Original file line number Diff line number Diff line change 11-- Error: tests/neg/i19731.scala:4:6 -----------------------------------------------------------------------------------
224 |class F1 extends Foo: // error
3-   |      ^
3+   |      ^^ 
44  |      class F1 needs to be abstract, since def foo(): Unit in class F1 is not defined 
55-- Error: tests/neg/i19731.scala:7:6 -----------------------------------------------------------------------------------
667 |class F2 extends Foo: // error
7-   |      ^
7+   |      ^^ 
88  |      class F2 needs to be abstract, since:
99  |      it has 2 unimplemented members.
1010  |      /** As seen from class F2, the missing signatures are as follows.
1414  |        def foo(x: Int): Unit = ???
1515-- Error: tests/neg/i19731.scala:16:6 ----------------------------------------------------------------------------------
161616 |class B1 extends Bar: // error
17-    |      ^
17+    |      ^^ 
1818   |      class B1 needs to be abstract, since:
1919   |      it has 2 unimplemented members.
2020   |      /** As seen from class B1, the missing signatures are as follows.
Original file line number Diff line number Diff line change 11-- Error: tests/neg/i21335.scala:7:6 -----------------------------------------------------------------------------------
227 |class Z1 extends Bar1 // error
3-   |      ^
3+   |      ^^ 
44  |      class Z1 needs to be abstract, since override def bar(): Bar1 in trait Bar1 is not defined 
55-- Error: tests/neg/i21335.scala:12:6 ----------------------------------------------------------------------------------
6612 |class Z2 extends Bar2 // error
7-    |      ^
7+    |      ^^ 
88   |      class Z2 needs to be abstract, since def bar(): Bar2 in trait Bar2 is not defined 
Original file line number Diff line number Diff line change 1+ -- Error: tests/neg/i22941.scala:4:6 -----------------------------------------------------------------------------------
2+ 4 |class Baz extends Foo: // error
3+   |      ^^^
4+   |      class Baz needs to be abstract, since def bar: String in trait Foo is not defined 
Original file line number Diff line number Diff line change 1+ trait  Foo : 
2+   def  bar :  String 
3+ 
4+ class  Baz  extends  Foo :  //  error
5+   val  a  =  " hello" 
Original file line number Diff line number Diff line change 11-- Error: tests/neg/i9329.scala:8:6 ------------------------------------------------------------------------------------
228 |class GrandSon extends Son // error
3-   |      ^
3+   |      ^^^^^^^^ 
44  |class GrandSon needs to be abstract, since def name: String in trait Parent is not defined 
55  |(The class implements abstract override def name: String in trait Son but that definition still needs an implementation)
Original file line number Diff line number Diff line change 1515   |        method ++ of type (xs: Alpha[String]): Alpha[String] misses a target name annotation @targetName(append)
1616-- Error: tests/neg/targetName-override.scala:14:6 ---------------------------------------------------------------------
171714 |class Beta extends Alpha[String] {  // error: needs to be abstract
18-    |      ^
18+    |      ^^^^ 
1919   |class Beta needs to be abstract, since there is a deferred declaration of method foo in class Alpha of type (x: String): String which is not implemented in a subclass
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments