Skip to content

Commit

Permalink
fix UsingParamAnonymousConstructor
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Jan 4, 2025
1 parent 13c3a95 commit fb69458
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ trait UsingParamAnonymousConstructorTest {
def f: Int = x1
}

class A3(using val x1: Int)

class A4(using var x1: Int)

class A5(using @annotation.nowarn x1: Int)

trait B1(using x1: Int)

trait B2(using x1: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ trait UsingParamAnonymousConstructorTest {
def f: Int = x1
}

class A3(using val x1: Int)

class A4(using var x1: Int)

class A5(using @annotation.nowarn x1: Int)

trait B1(using Int)

trait B2(using x1: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class UsingParamAnonymousConstructor extends SyntacticRule("UsingParamAnonymousC
val t = c.ctor
t.paramClauses.filter { paramClause =>
paramClause.values.forall(_.mods.exists(_.is[Mod.Using])) && paramClause.values.forall(m =>
!m.mods.exists(_.is[Mod.Inline]) && !m.mods.exists(_.is[Mod.Annot])
!m.mods.exists(x => x.is[Mod.Inline] || x.is[Mod.Annot] || x.is[Mod.ValParam] || x.is[Mod.VarParam])
)
}.map { paramClause =>
val countOneNames = c.collect { case x: Term.Name =>
Expand Down

0 comments on commit fb69458

Please sign in to comment.