@@ -1551,11 +1551,7 @@ object Parsers {
1551
1551
else { accept(TLARROW ); typ() }
1552
1552
}
1553
1553
else if in.token == LBRACE && followingIsCaptureSet() then
1554
- val refs = inBraces {
1555
- if in.token == RBRACE then Nil else commaSeparated(captureRef)
1556
- }
1557
- val t = typ()
1558
- CapturingTypeTree (refs, t)
1554
+ CapturingTypeTree (captureSet(), typ())
1559
1555
else if (in.token == INDENT ) enclosed(INDENT , typ())
1560
1556
else infixType()
1561
1557
@@ -1941,8 +1937,14 @@ object Parsers {
1941
1937
def typeDependingOn (location : Location ): Tree =
1942
1938
if location.inParens then typ()
1943
1939
else if location.inPattern then rejectWildcardType(refinedType())
1940
+ else if in.token == LBRACE && followingIsCaptureSet() then
1941
+ CapturingTypeTree (captureSet(), infixType())
1944
1942
else infixType()
1945
1943
1944
+ def captureSet (): List [Tree ] = inBraces {
1945
+ if in.token == RBRACE then Nil else commaSeparated(captureRef)
1946
+ }
1947
+
1946
1948
/* ----------- EXPRESSIONS ------------------------------------------------ */
1947
1949
1948
1950
/** Does the current conditional expression continue after
@@ -2012,7 +2014,7 @@ object Parsers {
2012
2014
* | ‘inline’ InfixExpr MatchClause
2013
2015
* Bindings ::= `(' [Binding {`,' Binding}] `)'
2014
2016
* Binding ::= (id | `_') [`:' Type]
2015
- * Ascription ::= `:' InfixType
2017
+ * Ascription ::= `:' [CaptureSet] InfixType
2016
2018
* | `:' Annotation {Annotation}
2017
2019
* | `:' `_' `*'
2018
2020
* Catches ::= ‘catch’ (Expr | ExprCaseClause)
@@ -4035,6 +4037,8 @@ object Parsers {
4035
4037
* |
4036
4038
* EnumStat ::= TemplateStat
4037
4039
* | Annotations Modifiers EnumCase
4040
+ * SelfType ::= id [‘:’ [CaptureSet] InfixType] ‘=>’
4041
+ * | ‘this’ ‘:’ [CaptureSet] InfixType ‘=>’
4038
4042
*/
4039
4043
def templateStatSeq (): (ValDef , List [Tree ]) = checkNoEscapingPlaceholders {
4040
4044
val stats = new ListBuffer [Tree ]
0 commit comments