Skip to content

Commit

Permalink
build(deps): update scalameta from 4.9.9 to 4.10.2 (#1644)
Browse files Browse the repository at this point in the history
* build(deps): update scalameta from 4.9.9 to 4.10.2

* Fix deprecation warnings

---------

Co-authored-by: Hugo van Rijswijk <[email protected]>
  • Loading branch information
scala-steward and hugo-vrijswijk authored Oct 21, 2024
1 parent c9c3c1d commit bc16794
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
25 changes: 12 additions & 13 deletions modules/core/src/main/scala/stryker4s/mutants/TreeTraverser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ final class TreeTraverserImpl() extends TreeTraverser {
def canPlace(currentTree: Tree): Option[Term] = {
currentTree.parent
.filter {
case ParentIsTypeLiteral() => false
case name: Name => !name.isDefinition
case t if t.is[Init] => false

case d: Defn.Def if d.body == currentTree => true
case d: Defn.Val if d.rhs == currentTree => true
case d: Defn.Var if d.body == currentTree => true
case _: Term.Block => true
case t: Term.Function if t.body == currentTree => true
case t: Case if t.body == currentTree => true
case t: Term.ForYield if t.body == currentTree => true
case t: Template if t.stats.contains(currentTree) => true
case _ => false
case ParentIsTypeLiteral() => false
case name: Name => !name.isDefinition
case t if t.is[Init] => false
case d: Defn.Def if d.body == currentTree => true
case d: Defn.Val if d.rhs == currentTree => true
case d: Defn.Var if d.body == currentTree => true
case _: Term.Block => true
case t: Term.Function if t.body == currentTree => true
case t: Case if t.body == currentTree => true
case t: Term.ForYield if t.body == currentTree => true
case t: Template.Body if t.stats.contains(currentTree) => true
case _ => false
}
.filterNot(_.isIn[Mod.Annot])
.as(currentTree)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ class MutantInstrumenter(options: InstrumenterOptions)(implicit log: Logger) {
// Match on mutation switching trees
case tree: Term.Match if tree.expr.isEqual(options.mutationContext) =>
// Filter out any cases that are in the same range as a compile error
val newCases = tree.cases.filterNot(caze => errors.exists(compileErrorIsInCaseStatement(caze, _)))
val newCases = tree.casesBlock.cases.filterNot(caze => errors.exists(compileErrorIsInCaseStatement(caze, _)))

tree.copy(cases = newCases)
}

def mutantIdsForCompileErrors(tree: Tree, errors: NonEmptyList[CompilerErrMsg]) = {
val mutationSwitchingCases = tree.collect {
val mutationSwitchingCases: List[Case] = tree.collect {
// Match on mutation switching trees
case tree: Term.Match if tree.expr.isEqual(options.mutationContext) =>
// Filter out default case as it's not mutated
tree.cases.filterNot(c => c.pat.isEqual(Pat.Wildcard()))
tree.casesBlock.cases.filterNot(_.pat.isEqual(Pat.Wildcard()))
}.flatten

errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class MutantInstrumenterTest extends Stryker4sSuite with TestData with LogMatche
// Assert
assertEquals(result.expr, "_root_.stryker4s.activeMutation".parseTerm)
assertEquals(
result.cases,
result.casesBlock.cases,
List(
"case 0 => x > 15".parseCase,
"case 1 => x <= 15".parseCase,
Expand Down Expand Up @@ -87,7 +87,7 @@ class MutantInstrumenterTest extends Stryker4sSuite with TestData with LogMatche
// // Assert
assertEquals(result.expr, "_root_.stryker4s.activeMutation".parseTerm)
assertEquals(
result.cases,
result.casesBlock.cases,
List(
"case 0 => true".parseCase,
"case 1 => false".parseCase,
Expand Down Expand Up @@ -129,7 +129,7 @@ class MutantInstrumenterTest extends Stryker4sSuite with TestData with LogMatche
// // Assert
assertEquals(result.expr, "_root_.scala.sys.env.get(\"ACTIVE_MUTATION\")".parseTerm)
assertEquals(
result.cases,
result.casesBlock.cases,
List(
"case Some(\"0\") => x > 15".parseCase,
"case Some(\"1\") => x <= 15".parseCase,
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object Dependencies {

val mutationTestingMetrics = "3.3.0"

val scalameta = "4.9.9"
val scalameta = "4.10.2"

val slf4j = "2.0.16"

Expand Down

0 comments on commit bc16794

Please sign in to comment.