Skip to content

Commit 3927cec

Browse files
committed
Change to new syntax in doc comments
... and fix a missing change when printing trees
1 parent f01ad50 commit 3927cec

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

compiler/src/dotty/tools/dotc/cc/CheckCaptures.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ object CheckCaptures:
5252
* @param outer0 the next enclosing environment
5353
*/
5454
case class Env(
55-
owner: Symbol,
56-
nestedInOwner: Boolean,
57-
captured: CaptureSet,
58-
isBoxed: Boolean,
59-
outer0: Env | Null
60-
):
55+
owner: Symbol,
56+
nestedInOwner: Boolean,
57+
captured: CaptureSet,
58+
isBoxed: Boolean,
59+
outer0: Env | Null):
60+
6161
def outer = outer0.nn
6262

6363
def isOutermost = outer0 == null

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,12 +1462,11 @@ object Parsers {
14621462
* | FunParamClause ‘=>>’ Type
14631463
* | MatchType
14641464
* | InfixType
1465-
* | CaptureSet Type -- under captureChecking
14661465
* FunType ::= (MonoFunType | PolyFunType)
14671466
* MonoFunType ::= FunTypeArgs (‘=>’ | ‘?=>’) Type
1468-
* | (‘->’ | ‘?->’ ) Type -- under pureFunctions
1467+
* | (‘->’ | ‘?->’ ) [CaptureSet] Type -- under pureFunctions
14691468
* PolyFunType ::= HKTypeParamClause '=>' Type
1470-
* | HKTypeParamClause ‘->’ Type -- under pureFunctions
1469+
* | HKTypeParamClause ‘->’ [CaptureSet] Type -- under pureFunctions
14711470
* FunTypeArgs ::= InfixType
14721471
* | `(' [ [ ‘[using]’ ‘['erased'] FunArgType {`,' FunArgType } ] `)'
14731472
* | '(' [ ‘[using]’ ‘['erased'] TypedFunParam {',' TypedFunParam } ')'
@@ -1951,13 +1950,13 @@ object Parsers {
19511950

19521951
/** FunArgType ::= Type
19531952
* | `=>' Type
1954-
* | [CaptureSet] `->' Type
1953+
* | `->' [CaptureSet] Type
19551954
*/
19561955
val funArgType: () => Tree = () => paramTypeOf(typ)
19571956

19581957
/** ParamType ::= ParamValueType
19591958
* | `=>' ParamValueType
1960-
* | [CaptureSet] `->' ParamValueType
1959+
* | `->' [CaptureSet] ParamValueType
19611960
*/
19621961
def paramType(): Tree = paramTypeOf(paramValueType)
19631962

@@ -2096,7 +2095,7 @@ object Parsers {
20962095
* | ‘inline’ InfixExpr MatchClause
20972096
* Bindings ::= `(' [Binding {`,' Binding}] `)'
20982097
* Binding ::= (id | `_') [`:' Type]
2099-
* Ascription ::= `:' [CaptureSet] InfixType
2098+
* Ascription ::= `:' InfixType
21002099
* | `:' Annotation {Annotation}
21012100
* | `:' `_' `*'
21022101
* Catches ::= ‘catch’ (Expr | ExprCaseClause)
@@ -4155,8 +4154,8 @@ object Parsers {
41554154
stats.toList
41564155
}
41574156

4158-
/** SelfType ::= id [‘:’ [CaptureSet] InfixType] ‘=>’
4159-
* | ‘this’ ‘:’ [CaptureSet] InfixType ‘=>’
4157+
/** SelfType ::= id [‘:’ InfixType] ‘=>’
4158+
* | ‘this’ ‘:’ InfixType ‘=>’
41604159
*/
41614160
def selfType(): ValDef =
41624161
if (in.isIdent || in.token == THIS)

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
628628
def toTextAnnot =
629629
toTextLocal(arg) ~~ annotText(annot.symbol.enclosingClass, annot)
630630
def toTextRetainsAnnot =
631-
try changePrec(GlobalPrec)(toTextCaptureSet(captureSet) ~ " " ~ toText(arg))
631+
try changePrec(GlobalPrec)(toText(arg) ~ "^" ~ toTextCaptureSet(captureSet))
632632
catch case ex: IllegalCaptureRef => toTextAnnot
633633
if annot.symbol.maybeOwner == defn.RetainsAnnot
634634
&& Feature.ccEnabled && Config.printCaptureSetsAsPrefix && !printDebug
@@ -741,7 +741,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
741741
val tptText = toTextGlobal(tpt)
742742
prefix ~~ idx.toString ~~ "|" ~~ tptText ~~ "|" ~~ argsText ~~ "|" ~~ contentText ~~ postfix
743743
case CapturesAndResult(refs, parent) =>
744-
changePrec(GlobalPrec)("^{" ~ Text(refs.map(toText), ", ") ~ "} " ~ toText(parent))
744+
changePrec(GlobalPrec)("^{" ~ Text(refs.map(toText), ", ") ~ "}" ~ toText(parent))
745745
case _ =>
746746
tree.fallbackToText(this)
747747
}

0 commit comments

Comments
 (0)