File tree Expand file tree Collapse file tree 3 files changed +59
-1
lines changed 
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 3 files changed +59
-1
lines changed Original file line number Diff line number Diff line change @@ -735,7 +735,10 @@ object Scanners {
735735                 &&  currentRegion.commasExpected
736736                 &&  (token ==  RPAREN  ||  token ==  RBRACKET  ||  token ==  RBRACE  ||  token ==  OUTDENT )
737737              then 
738-                 () /*  skip the trailing comma */ 
738+                 //  encountered a trailing comma
739+                 //  reset only the lastOffset
740+                 //  so that the tree's span is correct
741+                 lastOffset =  prev.lastOffset
739742              else 
740743                reset()
741744        case  END  => 
Original file line number Diff line number Diff line change 1+ -- [E006] Not Found Error: tests/neg/i16872.scala:8:6 ------------------------------------------------------------------
2+ 8 |      aa, // error
3+   |      ^^
4+   |      Not found: aa
5+   |
6+   | longer explanation available when compiling with `-explain`
7+ -- [E006] Not Found Error: tests/neg/i16872.scala:9:6 ------------------------------------------------------------------
8+ 9 |      bb, // error
9+   |      ^^
10+   |      Not found: bb
11+   |
12+   | longer explanation available when compiling with `-explain`
13+ -- [E006] Not Found Error: tests/neg/i16872.scala:10:6 -----------------------------------------------------------------
14+ 10 |      cc, // error
15+    |      ^^
16+    |      Not found: cc
17+    |
18+    | longer explanation available when compiling with `-explain`
19+ -- [E006] Not Found Error: tests/neg/i16872.scala:16:6 -----------------------------------------------------------------
20+ 16 |      dd, // error
21+    |      ^^
22+    |      Not found: dd
23+    |
24+    | longer explanation available when compiling with `-explain`
25+ -- [E006] Not Found Error: tests/neg/i16872.scala:17:6 -----------------------------------------------------------------
26+ 17 |      ee, // error
27+    |      ^^
28+    |      Not found: ee - did you mean eq? or perhaps ne?
29+    |
30+    | longer explanation available when compiling with `-explain`
31+ -- [E006] Not Found Error: tests/neg/i16872.scala:18:6 -----------------------------------------------------------------
32+ 18 |      ff, // error
33+    |      ^^
34+    |      Not found: ff
35+    |
36+    | longer explanation available when compiling with `-explain`
Original file line number Diff line number Diff line change 1+ //  Using a checkfile to verify where the carets point to.
2+ //  Originally they were pointing to "cc," and "ff,"
3+ //  including the trailing comma
4+ 
5+ class  Test : 
6+   def  t1  = 
7+     (
8+       aa, //  error
9+       bb, //  error
10+       cc, //  error
11+     )
12+ 
13+   def  meth (a : Int , b : Int , c : Int ) =  a +  b +  c
14+   def  t2  = 
15+     meth(
16+       dd, //  error
17+       ee, //  error
18+       ff, //  error
19+     )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments