Skip to content

Decide on the syntax of given in patterns #10087

Closed
@smarter

Description

@smarter

Currently the syntax for given in patterns looks like:

  def f1[T](x: Ordering[T]) = (x, x) match {
    case (given y: Ordering[T], _) => new TreeSet[T]
  }
  def f4[T](x: Ordering[T]) = {
    val xs = List(x, x, x)
    for given _: Ordering[T] <- xs
    yield new TreeSet[T]
  }

Which is different from the expression syntax where we write given Type or given name as Type, aligning ourselves would be nice, although the as syntax isn't so useful since we can use pattern bindings name @ given Type or name as given Type after #9837, so we could support only the given Type syntax.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions