Skip to content
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

Match type syntax under -source:future #12260

Closed
OlivierBlanvillain opened this issue Apr 28, 2021 · 0 comments · Fixed by #12261
Closed

Match type syntax under -source:future #12260

OlivierBlanvillain opened this issue Apr 28, 2021 · 0 comments · Fixed by #12261

Comments

@OlivierBlanvillain
Copy link
Contributor

Catch-all patterns in match type compile with a deprecation warning under -source:future:

type LeafElem[X] = X match
  case String => Char
  case Array[t] => LeafElem[t]
  case _ => X

// -- Deprecation Warning: tests/pos/6709.scala:5:7 -
// 5 |  case _ => X
//   |       ^
//   |       `_` is deprecated for wildcard arguments of types: use `?` instead

I think this is an oversight in the syntax and we should change

TypeCaseClause     ::= ‘case’ InfixType ‘=>’ Type [nl]

to

TypeCaseClause     ::= ‘case’ (InfixType | ‘_’) ‘=>’ Type [nl]
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Apr 28, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Apr 28, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue May 12, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue May 27, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Jun 9, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Jul 29, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Sep 8, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Sep 22, 2021
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Sep 22, 2021
@OlivierBlanvillain OlivierBlanvillain linked a pull request Sep 28, 2021 that will close this issue
OlivierBlanvillain added a commit to dotty-staging/dotty that referenced this issue Nov 18, 2021
odersky added a commit that referenced this issue Jan 23, 2022
Fix #12260: Add underscore to match type syntax
olsdavis pushed a commit to olsdavis/dotty that referenced this issue Apr 4, 2022
@Kordyjan Kordyjan added this to the 3.1.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants