Skip to content

Match type syntax under -source:future #12260

Closed
@OlivierBlanvillain

Description

@OlivierBlanvillain

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]

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions