Skip to content

Commit 29d041d

Browse files
committed
Prevent deprecation of _ in type patterns
1 parent 5454110 commit 29d041d

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Diff for: compiler/src/dotty/tools/dotc/parsing/Parsers.scala

-3
Original file line numberDiff line numberDiff line change
@@ -1860,9 +1860,6 @@ object Parsers {
18601860
val start = in.skipToken()
18611861
Ident(tpnme.USCOREkw).withSpan(Span(start, in.lastOffset, start))
18621862
else
1863-
if sourceVersion.isAtLeast(future) then
1864-
deprecationWarning(em"`_` is deprecated for wildcard arguments of types: use `?` instead")
1865-
patch(source, Span(in.offset, in.offset + 1), "?")
18661863
val start = in.skipToken()
18671864
typeBounds().withSpan(Span(start, in.lastOffset, start))
18681865
// Allow symbols -_ and +_ through for compatibility with code written using kind-projector in Scala 3 underscore mode.

Diff for: tests/pos-with-compiler-cc/dotc/parsing/Parsers.scala

-3
Original file line numberDiff line numberDiff line change
@@ -1730,9 +1730,6 @@ object Parsers {
17301730
val start = in.skipToken()
17311731
Ident(tpnme.USCOREkw).withSpan(Span(start, in.lastOffset, start))
17321732
else
1733-
if sourceVersion.isAtLeast(future) then
1734-
deprecationWarning(em"`_` is deprecated for wildcard arguments of types: use `?` instead")
1735-
patch(source, Span(in.offset, in.offset + 1), "?")
17361733
val start = in.skipToken()
17371734
typeBounds().withSpan(Span(start, in.lastOffset, start))
17381735
// Allow symbols -_ and +_ through for compatibility with code written using kind-projector in Scala 3 underscore mode.

Diff for: tests/pos/i18808.scala

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//> using options -Werror
2+
import language.future
3+
4+
type F[X] = X match
5+
case List[_] => Int
6+
7+
type G[X] = X match
8+
case List[?] => Int

0 commit comments

Comments
 (0)