From 6ab4e8087a9a7b804bbaf91443835d4cfcfbdbbf Mon Sep 17 00:00:00 2001 From: Jeff May Date: Mon, 28 Jun 2021 13:57:24 -0700 Subject: [PATCH] Deprecate overloaded methods. --- .../main/scala/vapors/dsl/ExprBuilder.scala | 55 +++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/core/src/main/scala/vapors/dsl/ExprBuilder.scala b/core/src/main/scala/vapors/dsl/ExprBuilder.scala index 6d205018c..865ac68ea 100644 --- a/core/src/main/scala/vapors/dsl/ExprBuilder.scala +++ b/core/src/main/scala/vapors/dsl/ExprBuilder.scala @@ -484,6 +484,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): FoldableExprBuilder[V, N, X, P] = new FoldableExprBuilder(buildGetExpr(buildLens)) + @deprecated( + "Use valuesOfType(...) to avoid needing this .value method or use .get(_.select(_.value)) instead.", + "0.17.0", + ) def value[X]( implicit ev: R <:< TypedFact[X], @@ -502,6 +506,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, R, P] = new ValExprBuilder(ExprDsl.add(returnOutput, rhs)) + @deprecated( + "Use + const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def +( rhs: R, )(implicit @@ -526,6 +534,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, R, P] = new ValExprBuilder(ExprDsl.multiply(returnOutput, rhs)) + @deprecated( + "Use * const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def *( rhs: R, )(implicit @@ -550,6 +562,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, R, P] = new ValExprBuilder(ExprDsl.subtract(returnOutput, rhs)) + @deprecated( + "Use - const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def -( rhs: R, )(implicit @@ -574,6 +590,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, R, P] = new ValExprBuilder(ExprDsl.divide(returnOutput, rhs)) + @deprecated( + "Use / const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def /( rhs: R, )(implicit @@ -615,6 +635,7 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) Expr.OutputWithinWindow(returnOutput, embed(const(window)(captureConst))(captureWindow), captureResult), ) + @deprecated("Use === const(...) instead. This method doesn't fit with the overall DSL.", "0.17.0") def isEqualTo( value: R, )(implicit @@ -625,6 +646,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, Boolean, P] = within(Window.equalTo(value)) + @deprecated( + "Use === const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def ===( value: R, )(implicit @@ -644,6 +669,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, Boolean, P] = withinWindow(Expr.WrapOutput(valueExpr, ExprConverter.asWindow[R](Window.equalTo(_)), captureWindow)) + @deprecated( + "Use !== const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def !==( value: R, )(implicit @@ -663,25 +692,33 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, Boolean, P] = Expr.Not(this === valueExpr, captureResult) + @deprecated( + "Use < const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def <( - valueExpr: Expr[V, R, P], + value: R, )(implicit orderR: Order[R], captureWindow: CaptureP[V, Window[R], P], + captureConst: CaptureP[FactTable, Window[R], P], captureResult: CaptureCondResult, ): ValExprBuilder[V, Boolean, P] = - withinWindow(Expr.WrapOutput(valueExpr, ExprConverter.asWindow[R](Window.lessThan(_)), captureWindow)) + within(Window.lessThan(value)) def <( - value: R, + valueExpr: Expr[V, R, P], )(implicit orderR: Order[R], captureWindow: CaptureP[V, Window[R], P], - captureConst: CaptureP[FactTable, Window[R], P], captureResult: CaptureCondResult, ): ValExprBuilder[V, Boolean, P] = - within(Window.lessThan(value)) + withinWindow(Expr.WrapOutput(valueExpr, ExprConverter.asWindow[R](Window.lessThan(_)), captureWindow)) + @deprecated( + "Use <= const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def <=( value: R, )(implicit @@ -701,6 +738,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, Boolean, P] = withinWindow(Expr.WrapOutput(valueExpr, ExprConverter.asWindow[R](Window.lessThanOrEqual(_)), captureWindow)) + @deprecated( + "Use > const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def >( value: R, )(implicit @@ -720,6 +761,10 @@ final class ValExprBuilder[V, R, P](override val returnOutput: Expr[V, R, P]) ): ValExprBuilder[V, Boolean, P] = withinWindow(Expr.WrapOutput(valueExpr, ExprConverter.asWindow[R](Window.greaterThan(_)), captureWindow)) + @deprecated( + "Use >= const(...) instead. This overloaded convenience method will be removed to support better type inference", + "0.17.0", + ) def >=( value: R, )(implicit