Skip to content

Commit

Permalink
Prevent deprecation of _ in type patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
ausmarton committed Nov 5, 2023
1 parent ef97ee2 commit 5a47c53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 0 additions & 3 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1860,9 +1860,6 @@ object Parsers {
val start = in.skipToken()
Ident(tpnme.USCOREkw).withSpan(Span(start, in.lastOffset, start))
else
if sourceVersion.isAtLeast(future) then
deprecationWarning(em"`_` is deprecated for wildcard arguments of types: use `?` instead")
patch(source, Span(in.offset, in.offset + 1), "?")
val start = in.skipToken()
typeBounds().withSpan(Span(start, in.lastOffset, start))
// Allow symbols -_ and +_ through for compatibility with code written using kind-projector in Scala 3 underscore mode.
Expand Down
3 changes: 0 additions & 3 deletions tests/pos-with-compiler-cc/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1730,9 +1730,6 @@ object Parsers {
val start = in.skipToken()
Ident(tpnme.USCOREkw).withSpan(Span(start, in.lastOffset, start))
else
if sourceVersion.isAtLeast(future) then
deprecationWarning(em"`_` is deprecated for wildcard arguments of types: use `?` instead")
patch(source, Span(in.offset, in.offset + 1), "?")
val start = in.skipToken()
typeBounds().withSpan(Span(start, in.lastOffset, start))
// Allow symbols -_ and +_ through for compatibility with code written using kind-projector in Scala 3 underscore mode.
Expand Down
8 changes: 8 additions & 0 deletions tests/pos/i18808.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//> using options -Werror
import language.future

type F[X] = X match
case List[_] => Int

type G[X] = X match
case List[?] => Int

0 comments on commit 5a47c53

Please sign in to comment.