Skip to content

Commit

Permalink
Fix scala 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
narma committed Aug 19, 2024
1 parent 9794d1d commit 6e245e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zio-http/shared/src/main/scala/zio/http/codec/PathCodec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ object PathCodec {
var result = subtree.value
var i = from

val trySkipLiteralIdx: mutable.ArrayDeque[Int] = mutable.ArrayDeque.empty
var trySkipLiteralIdx: List[Int] = Nil

while (i < nSegments) {
val segment = segments(i)
Expand All @@ -802,7 +802,7 @@ object PathCodec {
// this subtree segment have race with others
// will try others if result was empty
if (subtree.literalsRaceOthers.contains(segment)) {
trySkipLiteralIdx.addOne(i)
trySkipLiteralIdx = i +: trySkipLiteralIdx
}

subtree = subtree.literals(segment)
Expand Down Expand Up @@ -879,8 +879,10 @@ object PathCodec {
}

if (trySkipLiteralIdx.nonEmpty && result.isEmpty) {
trySkipLiteralIdx = trySkipLiteralIdx.reverse
while (trySkipLiteralIdx.nonEmpty && result.isEmpty) {
val skipIdx = trySkipLiteralIdx.removeHead()
val skipIdx = trySkipLiteralIdx.head
trySkipLiteralIdx = trySkipLiteralIdx.tail
result = get(path, from, skipLiteralsFor + skipIdx)
}
result
Expand Down

0 comments on commit 6e245e4

Please sign in to comment.