@@ -141,7 +141,7 @@ type val var while with yield
141
141
### Soft keywords
142
142
143
143
```
144
- as derives end erased extension infix inline opaque open throws tracked transparent using | * + -
144
+ as derives end erased extension infix inline mut opaque open throws tracked transparent using | * + -
145
145
```
146
146
147
147
See the [ separate section on soft keywords] ( ../reference/soft-modifier.md ) for additional
@@ -182,15 +182,19 @@ Type ::= FunType
182
182
| MatchType
183
183
| InfixType
184
184
FunType ::= FunTypeArgs (‘=>’ | ‘?=>’) Type Function(ts, t) | FunctionWithMods(ts, t, mods, erasedParams)
185
- | TypTypeParamClause '=>' Type PolyFunction(ps, t)
185
+ | FunTypeArgs (‘->’ | ‘?->’) [CaptureSet] Type -- under pureFunctions and captureChecking
186
+ | TypTypeParamClause ‘=>’ Type PolyFunction(ps, t)
187
+ | TypTypeParamClause ‘->’ [CaptureSet] Type -- under pureFunctions and captureChecking
186
188
FunTypeArgs ::= InfixType
187
189
| ‘(’ [ FunArgTypes ] ‘)’
188
190
| FunParamClause
189
191
FunParamClause ::= ‘(’ TypedFunParam {‘,’ TypedFunParam } ‘)’
190
192
TypedFunParam ::= [`erased`] id ‘:’ Type
191
193
MatchType ::= InfixType `match` <<< TypeCaseClauses >>>
192
194
InfixType ::= RefinedType {id [nl] RefinedType} InfixOp(t1, op, t2)
195
+ | RefinedType ‘^’ -- under captureChecking
193
196
RefinedType ::= AnnotType {[nl] Refinement} RefinedTypeTree(t, ds)
197
+ | AnnotType {[nl] Refinement} ‘^’ CaptureSet -- under captureChecking
194
198
AnnotType ::= SimpleType {Annotation} Annotated(t, annot)
195
199
AnnotType1 ::= SimpleType1 {Annotation} Annotated(t, annot)
196
200
@@ -210,26 +214,35 @@ Singleton ::= SimpleRef
210
214
| Singleton ‘.’ id
211
215
FunArgType ::= Type
212
216
| ‘=>’ Type PrefixOp(=>, t)
217
+ | ‘->’ [CaptureSet] Type -- under captureChecking
213
218
FunArgTypes ::= FunArgType { ‘,’ FunArgType }
214
219
ParamType ::= [‘=>’] ParamValueType
220
+ | ‘->’ [CaptureSet] ParamValueType -- under captureChecking
215
221
ParamValueType ::= Type [‘*’] PostfixOp(t, "*")
216
222
| IntoType
217
223
| ‘(’ IntoType ‘)’ ‘*’ PostfixOp(t, "*")
218
224
IntoType ::= [‘into’] IntoTargetType Into(t)
219
225
| ‘(’ IntoType ‘)’
220
226
IntoTargetType ::= Type
221
227
| FunTypeArgs (‘=>’ | ‘?=>’) IntoType
222
- TypeArgs ::= ‘[’ Types ‘]’ ts
228
+ TypeArgs ::= ‘[’ TypeArg {‘,’ TypeArg} ‘]’ ts
223
229
Refinement ::= :<<< [RefineDcl] {semi [RefineDcl]} >>> ds
224
- TypeBounds ::= [‘>:’ Type ] [‘<:’ Type] TypeBoundsTree(lo, hi)
230
+ TypeBounds ::= [‘>:’ TypeBound ] [‘<:’ TypeBound] TypeBoundsTree(lo, hi)
225
231
TypeAndCtxBounds ::= TypeBounds [‘:’ ContextBounds] ContextBounds(typeBounds, tps)
226
232
ContextBounds ::= ContextBound
227
233
| ContextBound `:` ContextBounds -- to be deprecated
228
234
| '{' ContextBound {',' ContextBound} '}'
229
235
ContextBound ::= Type ['as' id]
230
236
Types ::= Type {‘,’ Type}
237
+ TypeArg ::= Type
238
+ | CaptureSet -- under captureChecking
239
+ TypeBound ::= Type
240
+ | CaptureSet -- under captureChecking
231
241
NamesAndTypes ::= NameAndType {‘,’ NameAndType}
232
242
NameAndType ::= id ':' Type
243
+ CaptureSet ::= ‘{’ CaptureRef {‘,’ CaptureRef} ‘}’ -- under captureChecking
244
+ CaptureRef ::= { SimpleRef ‘.’ } SimpleRef [‘*’] [‘.’ ‘rd’] -- under captureChecking
245
+ | [ { SimpleRef ‘.’ } SimpleRef ‘.’ ] id -- under captureChecking
233
246
```
234
247
235
248
### Expressions
@@ -365,16 +378,20 @@ ArgumentPatterns ::= ‘(’ [Patterns] ‘)’
365
378
ClsTypeParamClause::= ‘[’ ClsTypeParam {‘,’ ClsTypeParam} ‘]’
366
379
ClsTypeParam ::= {Annotation} [‘+’ | ‘-’] TypeDef(Modifiers, name, tparams, bounds)
367
380
id [HkTypeParamClause] TypeAndCtxBounds Bound(below, above, context)
381
+ | {Annotation} id [`^`] TypeAndCtxBounds -- under captureChecking
368
382
369
383
DefTypeParamClause::= [nl] ‘[’ DefTypeParam {‘,’ DefTypeParam} ‘]’
370
384
DefTypeParam ::= {Annotation} id [HkTypeParamClause] TypeAndCtxBounds
385
+ | {Annotation} id [`^`] TypeAndCtxBounds -- under captureChecking
371
386
372
387
TypTypeParamClause::= ‘[’ TypTypeParam {‘,’ TypTypeParam} ‘]’
373
- TypTypeParam ::= {Annotation} (id | ‘_’) [HkTypeParamClause] TypeBounds
388
+ TypTypeParam ::= {Annotation} (id | ‘_’) [HkTypeParamClause] TypeAndCtxBounds
389
+ | {Annotation} id [`^`] TypeAndCtxBounds -- under captureChecking
374
390
375
391
HkTypeParamClause ::= ‘[’ HkTypeParam {‘,’ HkTypeParam} ‘]’
376
392
HkTypeParam ::= {Annotation} [‘+’ | ‘-’] (id | ‘_’) [HkTypeParamClause]
377
393
TypeBounds
394
+ | {Annotation} id [`^`] TypeBounds -- under captureChecking
378
395
379
396
ClsParamClauses ::= {ClsParamClause} [[nl] ‘(’ [‘implicit’] ClsParams ‘)’]
380
397
ClsParamClause ::= [nl] ‘(’ ClsParams ‘)’
@@ -419,6 +436,7 @@ LocalModifier ::= ‘abstract’
419
436
| ‘infix’
420
437
| ‘erased’
421
438
| ‘tracked’
439
+ | ‘mut’ -- under captureChecking
422
440
423
441
AccessModifier ::= (‘private’ | ‘protected’) [AccessQualifier]
424
442
AccessQualifier ::= ‘[’ id ‘]’
@@ -462,7 +480,10 @@ DefDef ::= DefSig [‘:’ Type] [‘=’ Expr]
462
480
| ‘this’ ConstrParamClauses [DefImplicitClause] ‘=’ ConstrExpr DefDef(_, <init>, vparamss, EmptyTree, expr | Block)
463
481
DefSig ::= id [DefParamClauses] [DefImplicitClause]
464
482
TypeDef ::= id [HkTypeParamClause] {FunParamClause} TypeAndCtxBounds TypeDefTree(_, name, tparams, bound
465
- [‘=’ Type]
483
+ [‘=’ TypeDefRHS]
484
+ | id [`^`] TypeAndCtxBounds [‘=’ TypeDefRHS] -- under captureChecking
485
+ TypeDefRHS ::= Type
486
+ | CaptureSet -- under captureChecking
466
487
467
488
TmplDef ::= ([‘case’] ‘class’ | ‘trait’) ClassDef
468
489
| [‘case’] ‘object’ ObjectDef
0 commit comments