@@ -122,12 +122,18 @@ object PathFilter extends LowPriorityPathFilter {
122
122
case g => new OrPathFilter (f, g)
123
123
}
124
124
}
125
- def unary_! : PathFilter = pathFilter match {
126
- case AllPass => NoPass
127
- case NoPass => AllPass
128
- case IsHidden => IsNotHidden
129
- case IsNotHidden => IsHidden
130
- case pf => new NotPathFilter (pf)
125
+ def unary_! : PathFilter = {
126
+ def not (pf : PathFilter ): PathFilter = pf match {
127
+ case AllPass => NoPass
128
+ case NoPass => AllPass
129
+ case IsHidden => IsNotHidden
130
+ case IsNotHidden => IsHidden
131
+ case p : NotPathFilter => p.filter
132
+ case af : AndPathFilter => new OrPathFilter (not(af.left), not(af.right))
133
+ case of : OrPathFilter => new AndPathFilter (not(of.left), not(of.right))
134
+ case pf => new NotPathFilter (pf)
135
+ }
136
+ not(pathFilter)
131
137
}
132
138
}
133
139
@@ -257,8 +263,7 @@ private[sbt] case object NoPass extends PathFilter {
257
263
override def accept (path : Path , attributes : FileAttributes ): Boolean = false
258
264
}
259
265
260
- private [sbt] class AndPathFilter (private val left : PathFilter , private val right : PathFilter )
261
- extends PathFilter {
266
+ private [sbt] class AndPathFilter (val left : PathFilter , val right : PathFilter ) extends PathFilter {
262
267
override def accept (path : Path , attributes : FileAttributes ): Boolean =
263
268
left.accept(path, attributes) && right.accept(path, attributes)
264
269
override def equals (obj : Any ): Boolean = obj match {
@@ -269,8 +274,7 @@ private[sbt] class AndPathFilter(private val left: PathFilter, private val right
269
274
override def toString : String = s " $left && $right"
270
275
}
271
276
272
- private [sbt] class OrPathFilter (private val left : PathFilter , private val right : PathFilter )
273
- extends PathFilter {
277
+ private [sbt] class OrPathFilter (val left : PathFilter , val right : PathFilter ) extends PathFilter {
274
278
override def accept (path : Path , attributes : FileAttributes ): Boolean =
275
279
left.accept(path, attributes) || right.accept(path, attributes)
276
280
override def hashCode : Int = (left.## * 31 ) ^ right.##
@@ -281,7 +285,7 @@ private[sbt] class OrPathFilter(private val left: PathFilter, private val right:
281
285
override def toString : String = s " $left || $right"
282
286
}
283
287
284
- private [sbt] class NotPathFilter (private val filter : PathFilter ) extends PathFilter {
288
+ private [sbt] class NotPathFilter (val filter : PathFilter ) extends PathFilter {
285
289
override def accept (path : Path , attributes : FileAttributes ): Boolean =
286
290
! filter.accept(path, attributes)
287
291
override def equals (obj : Any ): Boolean = obj match {
0 commit comments