This is an automated email from the ASF dual-hosted git repository.
He-Pin pushed a commit to branch pr-1067
in repository https://gitbox.apache.org/repos/asf/pekko-http.git
The following commit(s) were added to refs/heads/pr-1067 by this push:
new fe5e42fbb fix: remove explicit implicit passing in PathMatcher
provide/apply
fe5e42fbb is described below
commit fe5e42fbb4b3b616dfc074f1689e3f8b1d6e28df
Author: 虎鸣 <[email protected]>
AuthorDate: Mon Jun 15 21:19:27 2026 +0800
fix: remove explicit implicit passing in PathMatcher provide/apply
Motivation:
Scala 2.13 reports ambiguous implicit values when `provide` and `apply`
explicitly pass `(ev)` to both the PathMatcher constructor and Matched
case class, creating two `ev: Tuple[L]` candidates in scope (method
parameter and constructor val).
Modification:
Remove explicit `(ev)` from constructor calls and Matched invocations
in `provide` and `apply`, letting implicit resolution pick up `ev` from
the method's implicit parameter — matching the behavior of the original
`[L: Tuple]` context bound pattern.
Result:
PathMatcher compiles cleanly on both Scala 2.13.18 and 3.3.8 with no
ambiguous implicit errors.
Tests:
- sbt "++ 2.13.18; http/compile" passes
- sbt "++ 3.3.8; http/compile" passes
- sbt "++ 2.13.18; http-tests/Test/testOnly ...PathDirectivesSpec" 222
passed
- sbt "++ 2.13.18; http-tests/Test/testOnly ...EntityStreamingSpec" 11
passed
References:
Refs #1067
---
.../scala/org/apache/pekko/http/scaladsl/server/PathMatcher.scala | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/PathMatcher.scala
b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/PathMatcher.scala
index af10a00f9..147d22fd9 100644
---
a/http/src/main/scala/org/apache/pekko/http/scaladsl/server/PathMatcher.scala
+++
b/http/src/main/scala/org/apache/pekko/http/scaladsl/server/PathMatcher.scala
@@ -157,8 +157,8 @@ object PathMatcher extends ImplicitPathMatcherConstruction {
* Creates a PathMatcher that always matches, consumes nothing and extracts
the given Tuple of values.
*/
def provide[L](extractions: L)(implicit ev: Tuple[L]): PathMatcher[L] =
- new PathMatcher[L]()(ev) {
- def apply(path: Path) = Matched(path, extractions)(ev)
+ new PathMatcher[L] {
+ def apply(path: Path) = Matched(path, extractions)
}
/**
@@ -167,9 +167,9 @@ object PathMatcher extends ImplicitPathMatcherConstruction {
*/
def apply[L](prefix: Path, extractions: L)(implicit ev: Tuple[L]):
PathMatcher[L] =
if (prefix.isEmpty) provide(extractions)
- else new PathMatcher[L]()(ev) {
+ else new PathMatcher[L] {
def apply(path: Path) =
- if (path.startsWith(prefix)) Matched(path.dropChars(prefix.charCount),
extractions)(ev)
+ if (path.startsWith(prefix)) Matched(path.dropChars(prefix.charCount),
extractions)
else Unmatched
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]