Skip to content

fix(operators)!: mark ArithmeticOperator.FromSymbol as obsolete - #148

Open
pdevito3 wants to merge 1 commit into
mainfrom
fm/qk-breaking-fromsymbol-obsolete
Open

pdevito3 wants to merge 1 commit into
mainfrom
fm/qk-breaking-fromsymbol-obsolete

Conversation

@pdevito3

@pdevito3 pdevito3 commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

For later consideration in a major version. Do not merge now. #134 removed the Obsolete mark to keep v1.x compatible (restore commit 19125d1). This PR re-applies the Obsolete mark of d507c87. The captain decides on this PR separately.

Alternative to PR 124

This PR and #124 are alternatives. Merge only one of them. This PR keeps FromSymbol and marks it [Obsolete]. PR 124 removes FromSymbol. The captain picks one.

Summary

+    [Obsolete("QueryKit does not use FromSymbol. The next major version removes it.")]
     public static ArithmeticOperator? FromSymbol(string symbol) => symbol switch

The change is in QueryKit/Operators/ArithmeticOperator.cs only. The method body does not change.

v1.14.2 behavior (and main)

ArithmeticOperator.FromSymbol is a public method with no Obsolete attribute. A call to it compiles with no warning.

New behavior

A call to ArithmeticOperator.FromSymbol compiles with warning CS0618 and the message "QueryKit does not use FromSymbol. The next major version removes it." The method returns the same values as before.

Example

var op = ArithmeticOperator.FromSymbol("+");
  • v1.14.2 and main: no warning.
  • This PR: warning CS0618: 'ArithmeticOperator.FromSymbol(string)' is obsolete: 'QueryKit does not use FromSymbol. The next major version removes it.' With TreatWarningsAsErrors, the build fails.

Justification

QueryKit does not use FromSymbol. The Obsolete mark tells callers before the next major version removes the method. A removal with no warning breaks callers with no notice.

Migration

Replace the call with your own map from the symbol to ArithmeticOperator.Add, Subtract, Multiply, Divide, or Modulo. Or suppress CS0618 at the call until the removal.

README

No change. The README does not document FromSymbol.

Tests

The CS0618 pragmas come back from main before #134 in 2 unit tests in ArithmeticOperatorTests: from_symbol_returns_the_operator_for_the_symbol and from_symbol_returns_null_for_an_unknown_symbol. The assertions do not change. No integration test changes.

dotnet test: 470 unit tests and 297 Postgres integration tests (Testcontainers) pass, 0 failures.

Rebase on main

This branch is rebased on current main (#169). The rebase had no conflicts. The breaking change did not change.

QueryKit does not use the public method ArithmeticOperator.FromSymbol. Mark it obsolete, so that callers get a warning before the next major version removes it.

BREAKING CHANGE: a call to ArithmeticOperator.FromSymbol now gives warning CS0618. A project that treats warnings as errors does not compile. Map the symbol to ArithmeticOperator.Add, Subtract, Multiply, Divide, or Modulo in your own code.
@pdevito3
pdevito3 force-pushed the fm/qk-breaking-fromsymbol-obsolete branch from 4ec4330 to e27202a Compare October 1, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant