Skip to content

Commit

Permalink
Deprecate overloaded methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffmay committed Jun 28, 2021
1 parent b8e36c4 commit 6ab4e80
Showing 1 changed file with 50 additions and 5 deletions.
55 changes: 50 additions & 5 deletions core/src/main/scala/vapors/dsl/ExprBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6ab4e80

Please sign in to comment.