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
3 | def f(x: Int) given (y: String) (z: Int) = x + z
97
+
| ^
98
+
| normal parameters cannot come after `given' clauses
99
+
one error found
100
+
```
101
+
102
+
The following code is the correct way to express the program in question:
93
103
94
104
```scala
95
105
implied forString="foo"
@@ -118,7 +128,10 @@ Dotty compiler will allow such a pattern binding only if the pattern is *irrefut
118
128
If we want to force the pattern binding if the pattern is not irrefutable, we can do so with an annotation:
119
129
120
130
```scala
121
-
valfirst::rest : @unchecked = elems // OK
131
+
scala>valxs:List[Any] =List("1", "2", "3")
132
+
|val (x: String) ::_: @unchecked = xs
133
+
valx:String=1
134
+
valxs:List[Any] =List(1, 2, 3)
122
135
```
123
136
124
137
The same is implemented for pattern bindings in `for` expressions:
@@ -131,13 +144,13 @@ The same is implemented for pattern bindings in `for` expressions:
131
144
132
145
For the migration purposes, the above change will only take effect in Dotty 3.1 by default. You can use it from Dotty 3 with the `-strict` flag.
133
146
147
+
For more information, see the [documentation](http://dotty.epfl.ch/docs/reference/changed-features/pattern-bindings.html).
134
148
135
-
## Other changes
136
149
137
-
Some of the other changes include:
150
+
## Other changes
151
+
Some of the other notable changes include:
138
152
139
-
-`infer` method renamed to `the`, the semantics of which is now the same as that of the `the` method of Shapeless. Namely, the implicits are resolved more precisely – see this [gist](https://gist.github.com/milessabin/8833a1dbf7e8245b30f8) for an example in Shapeless, and the Dotty [documentation](http://dotty.epfl.ch/docs/reference/contextual/inferable-params.html#querying-implied-instances) for more details.
140
-
- The syntax of quoting and splicing was changed. Now the quoting is expressed via `'{ ... }` and `'[...]` and splicing – via `${...}` and `$id`. Please see the [documentation](http://dotty.epfl.ch/docs/reference/other-new-features/principled-meta-programming.html) for more details on these features.
0 commit comments