You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
closesscala#22542
Introduce new syntax to make classes with `tracked` parameters
easier to use. The new syntax is essentially the ability to use an
application
of a class constructor as a type, we call such types applied constructor
types.
With this new feature the following example compiles correctly and the
type in
the comment is the resulting type of the applied constructor types.
```scala
import scala.language.experimental.modularity
class C(tracked val v: Any)
val c: C(42) /* C { val v: 42 } */ = C(42)
```
### Syntax change
```
SimpleType ::= SimpleLiteral
| ‘?’ TypeBounds
--- | SimpleType1
+++ | SimpleType1 {ParArgumentExprs}
```
A `SimpleType` can now optionally be followed by `ParArgumentExprs`.
---------
Co-authored-by: Matt Bovel <[email protected]>
Example
Under
modularity
, it should be possible to have a shorter way for writing precise types of class applications (for classes withtracked
parameters)For example, it should be possible to write the following code:
The text was updated successfully, but these errors were encountered: