Skip to content

[2.x] Fix Aggregation.printSettings pattern matching#8790

Merged
eed3si9n merged 1 commit intosbt:developfrom
xuwei-k:Aggregation-printSettings
Feb 23, 2026
Merged

[2.x] Fix Aggregation.printSettings pattern matching#8790
eed3si9n merged 1 commit intosbt:developfrom
xuwei-k:Aggregation-printSettings

Conversation

@xuwei-k
Copy link
Copy Markdown
Member

@xuwei-k xuwei-k commented Feb 23, 2026

xs is Seq not List.

I think following code is anti pattern.

val xs: Seq[A] = ???
xs match {
  case _ :: Nil => // patten match by List
  case _ =>
}
Welcome to Scala 3.8.1 (21.0.10, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                                            
scala> def f[A](xs: Seq[A]): String = xs match {
         case _ :: Nil => "Seq size is 1"
         case _ => "other"
       }
def f[A](xs: Seq[A]): String
                                                                                                                                            
scala> f(List("aaa"))
val res0: String = "Seq size is 1"
                                                                                                                                            
scala> f(Vector("aaa"))
val res1: String = "other"

@eed3si9n eed3si9n merged commit 808dfef into sbt:develop Feb 23, 2026
15 checks passed
@xuwei-k xuwei-k deleted the Aggregation-printSettings branch March 27, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants