File tree 2 files changed +28
-1
lines changed
2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ AnnotType1 ::= SimpleType1 {Annotation}
196
196
197
197
SimpleType ::= SimpleLiteral SingletonTypeTree(l)
198
198
| ‘?’ TypeBounds
199
- | SimpleType1
199
+ | SimpleType1 {ParArgumentExprs}
200
200
SimpleType1 ::= id Ident(name)
201
201
| Singleton ‘.’ id Select(t, name)
202
202
| Singleton ‘.’ ‘type’ SingletonTypeTree(p)
Original file line number Diff line number Diff line change @@ -196,6 +196,33 @@ LocalModifier ::= ‘tracked’
196
196
197
197
The (soft) ` tracked ` modifier is allowed as a local modifier.
198
198
199
+ ## Applied constructor types
200
+
201
+ A new syntax is also introduced, to make classes with ` tracked ` parameters
202
+ easier to use. The new syntax is essentially the ability to use an application
203
+ of a class constructor as a type, we call such types applied constructor types.
204
+
205
+ With this new feature the following example compiles correctly and the type in
206
+ the comment is the resulting type of the applied constructor types.
207
+
208
+ ``` scala
209
+ import scala .language .experimental .modularity
210
+
211
+ class Box (tracked val v : Any )
212
+
213
+ val c : C (42 ) /* C { val v: 42 } */ = C (42 )
214
+ ```
215
+
216
+ ### Syntax change
217
+
218
+ ```
219
+ SimpleType ::= SimpleLiteral
220
+ | ‘?’ TypeBounds
221
+ --- | SimpleType1
222
+ +++ | SimpleType1 {ParArgumentExprs}
223
+ ```
224
+
225
+ A ` SimpleType ` can now optionally be followed by ` ParArgumentExprs ` .
199
226
200
227
## Allow Class Parents to be Refined Types
201
228
You can’t perform that action at this time.
0 commit comments