-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate _
syntax for type wildcards
#18869
Comments
_
syntax for wildcards (needs Scala-2 change, PR pending)_
syntax for type wildcards
Based on #18887 First part of #18869 * In `3.4` we emit the deprecation warning and enable the patch with `-rewrite`. * In `future` we emit we make this syntax an error ```scala //> using options -source future def f: F[_] = ??? // error ``` ```diff //> using options -rewrite -source 3.4-migration - def f: F[_] = ??? + def f: F[?] = ??? ```
I just saw that we now warn on: trait Base[X]
trait One[X] extends Base[X]
trait Two[X] extends Base[X]
def foo(one: One[Int]) = one match
case two: Two[_] =>
two: Two[Int]
case _ =>
() ```-- Warning: try/cond-map.scala:26:16 -------------------------------------------
26 | case two: Two[_] =>
| ^
|`_` is deprecated for wildcard arguments of types: use `?` instead
|This construct can be rewritten automatically under -rewrite -source 3.4-migration. I think this is misleading: in a type test, |
|
We could generalize #18887 to all patterns. |
Followup in #19249 |
Warn in: 3.4
Error in: TBD
The text was updated successfully, but these errors were encountered: