File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ object desugar {
182182 tpt = TypeTree (defn.UnitType ),
183183 rhs = setterRhs
184184 ).withMods((mods | Accessor ) &~ (CaseAccessor | GivenOrImplicit | Lazy ))
185- .dropEndIndex
185+ .dropEndIndex() // the end marker should only appear on the getter definition
186186 Thicket (vdef1, setter)
187187 }
188188 else vdef1
@@ -875,7 +875,7 @@ object desugar {
875875 val modul = ValDef (moduleName, clsRef, New (clsRef, Nil ))
876876 .withMods(mods.toTermFlags & RetainedModuleValFlags | ModuleValCreationFlags )
877877 .withSpan(mdef.span.startPos)
878- .withEndIndex(copyFrom= mdef)
878+ .withEndIndex(copyFrom = mdef) // copy over the end market position to the module val
879879 val ValDef (selfName, selfTpt, _) = impl.self
880880 val selfMods = impl.self.mods
881881 if (! selfTpt.isEmpty) report.error(ObjectMayNotHaveSelfType (mdef), impl.self.srcPos)
Original file line number Diff line number Diff line change @@ -346,10 +346,10 @@ object Trees {
346346 self.withAttachment(EndIndex , index)
347347
348348 final def withEndIndex (copyFrom : WithEndMarker ): self.type =
349- copyFrom.endIndex.foreach(index => withEndIndex(index) )
349+ copyFrom.endIndex.foreach(withEndIndex)
350350 this
351351
352- final def dropEndIndex : self.type =
352+ final def dropEndIndex () : self.type =
353353 self.removeAttachment(EndIndex )
354354 this
355355
Original file line number Diff line number Diff line change @@ -1293,20 +1293,20 @@ object Parsers {
12931293 case _ : (ForYield | ForDo ) => in.token == FOR
12941294 case _ => false
12951295
1296- def matchesWithUpdated (stat : Tree ): Boolean = {
1296+ def matchesAndSetEnd (stat : Tree ): Boolean = {
12971297 val didMatch = matches(stat)
12981298 if didMatch then
12991299 stat match
13001300 case stat : WithEndMarker =>
1301- stat.withEndIndex(index= in.lastCharOffset)
1301+ stat.withEndIndex(index = in.lastCharOffset)
13021302 case _ =>
13031303 ()
13041304 didMatch
13051305 }
13061306
13071307 if in.token == END then
13081308 val start = in.skipToken()
1309- if stats.isEmpty || ! matchesWithUpdated (stats.last) then
1309+ if stats.isEmpty || ! matchesAndSetEnd (stats.last) then
13101310 syntaxError(" misaligned end marker" , Span (start, in.lastCharOffset))
13111311 in.token = IDENTIFIER // Leaving it as the original token can confuse newline insertion
13121312 in.nextToken()
You can’t perform that action at this time.
0 commit comments