diff --git a/akka-http/src/main/scala/akka/http/scaladsl/server/directives/FormFieldDirectives.scala b/akka-http/src/main/scala/akka/http/scaladsl/server/directives/FormFieldDirectives.scala index f9c8525f30..c027812a98 100644 --- a/akka-http/src/main/scala/akka/http/scaladsl/server/directives/FormFieldDirectives.scala +++ b/akka-http/src/main/scala/akka/http/scaladsl/server/directives/FormFieldDirectives.scala @@ -115,11 +115,11 @@ object FormFieldDirectives extends FormFieldDirectives { import akka.http.scaladsl.server.util.TupleOps._ import akka.http.scaladsl.server.util.BinaryPolyFunc - implicit def forTuple[T](implicit fold: FoldLeft[Directive0, T, ConvertParamDefAndConcatenate.type]): FieldDefAux[T, fold.Out] = + implicit def forTuple[T](implicit fold: FoldLeft[Directive0, T, ConvertFieldDefAndConcatenate.type]): FieldDefAux[T, fold.Out] = fieldDef[T, fold.Out](fold(pass, _)) - object ConvertParamDefAndConcatenate extends BinaryPolyFunc { - implicit def from[P, TA, TB](implicit fdef: FieldDefAux[P, Directive[TB]], ev: Join[TA, TB]) = + object ConvertFieldDefAndConcatenate extends BinaryPolyFunc { + implicit def from[P, TA, TB](implicit fdef: FieldDefAux[P, Directive[TB]], ev: Join[TA, TB]): BinaryPolyFunc.Case[Directive[TA], P, ConvertFieldDefAndConcatenate.type] { type Out = Directive[ev.Out] } = at[Directive[TA], P] { (a, t) ⇒ a & fdef(t) } } } diff --git a/akka-http/src/main/scala/akka/http/scaladsl/server/directives/ParameterDirectives.scala b/akka-http/src/main/scala/akka/http/scaladsl/server/directives/ParameterDirectives.scala index a9c3b64be0..0f007fa336 100644 --- a/akka-http/src/main/scala/akka/http/scaladsl/server/directives/ParameterDirectives.scala +++ b/akka-http/src/main/scala/akka/http/scaladsl/server/directives/ParameterDirectives.scala @@ -137,7 +137,7 @@ object ParameterDirectives extends ParameterDirectives { paramDef[T, fold.Out](fold(BasicDirectives.pass, _)) object ConvertParamDefAndConcatenate extends BinaryPolyFunc { - implicit def from[P, TA, TB](implicit pdef: ParamDef[P] { type Out = Directive[TB] }, ev: Join[TA, TB]) = + implicit def from[P, TA, TB](implicit pdef: ParamDef[P] { type Out = Directive[TB] }, ev: Join[TA, TB]): BinaryPolyFunc.Case[Directive[TA], P, ConvertParamDefAndConcatenate.type] { type Out = Directive[ev.Out] } = at[Directive[TA], P] { (a, t) ⇒ a & pdef(t) } } } diff --git a/akka-http/src/main/scala/akka/http/scaladsl/server/util/TupleOps.scala b/akka-http/src/main/scala/akka/http/scaladsl/server/util/TupleOps.scala index 2df524f102..e6cf4c8fbf 100644 --- a/akka-http/src/main/scala/akka/http/scaladsl/server/util/TupleOps.scala +++ b/akka-http/src/main/scala/akka/http/scaladsl/server/util/TupleOps.scala @@ -42,20 +42,22 @@ object TupleOps { type Out def apply(prefix: P, suffix: S): Out } + type JoinAux[P, S, O] = Join[P, S] { type Out = O } object Join extends LowLevelJoinImplicits { // O(1) shortcut for the Join[Unit, T] case to avoid O(n) runtime in this case - implicit def join0P[T] = + implicit def join0P[T]: JoinAux[Unit, T, T] = new Join[Unit, T] { type Out = T def apply(prefix: Unit, suffix: T): Out = suffix } // we implement the join by folding over the suffix with the prefix as growing accumulator object Fold extends BinaryPolyFunc { - implicit def step[T, A](implicit append: AppendOne[T, A]) = at[T, A](append(_, _)) + implicit def step[T, A](implicit append: AppendOne[T, A]): BinaryPolyFunc.Case[T, A, Fold.type] { type Out = append.Out } = + at[T, A](append(_, _)) } } sealed abstract class LowLevelJoinImplicits { - implicit def join[P, S](implicit fold: FoldLeft[P, S, Join.Fold.type]) = + implicit def join[P, S](implicit fold: FoldLeft[P, S, Join.Fold.type]): JoinAux[P, S, fold.Out] = new Join[P, S] { type Out = fold.Out def apply(prefix: P, suffix: S): Out = fold(prefix, suffix)