Skip to content

Commit

Permalink
Fix for Scala 3.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
xerial committed Sep 29, 2024
1 parent f5f7c37 commit a250e93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object RouteMatcher extends LogSupport {
}

def findRoute[Req](request: Req)(implicit tp: HttpRequestAdapter[Req]): Option[RouteMatch] = {
routesByMethod.get(tp.methodOf(request)).flatMap { nextRouter => nextRouter.findRoute(request)(tp) }
routesByMethod.get(tp.methodOf(request)).flatMap { nextRouter => nextRouter.findRoute(request)(using tp) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@ class PathDependentTypeTest extends AirSpec:

test("pass dependent types") {
val s = Surface.of[MyProfile#Backend]
s.name shouldBe "Backend"
s.toString shouldBe "Backend:=MyBackend"
if s.name == "MyBackend" then
// Scala 3.5.x or later
s.toString shouldBe "MyBackend"
else
s.name shouldBe "Backend"
s.toString shouldBe "Backend:=MyBackend"
}

test("nested path dependent types") {
val s = Surface.of[MyProfile#Backend#Database]
s.name shouldBe "Database"
s.toString shouldBe "Database:=DatabaseDef"
if s.name == "DatabaseDef" then
// Scala 3.5.x or later
s.toString shouldBe "DatabaseDef"
else
s.name shouldBe "Database"
s.toString shouldBe "Database:=DatabaseDef"
}

0 comments on commit a250e93

Please sign in to comment.