Skip to content

main: RangeSetContains.Equivalent hands any other one-argument Contains on RangeSet to the value overload #320

Open

Description

@CaffeinatedCoder

Problem

RangeSetContains.Equivalent (src/CodoMetis.ValueRanges.EFCore.PostgreSQL/Query/RangeSetContains.cs:62-64) maps a RangeSet<TRange, T>.Contains instance method to its static form by operand type: Set when the operand is the set type, Range when it is IRange<>, and Value for any other operand. Today the three overloads are the only ones, so every answer is right.

An overload added later, such as Contains(TRange) or one over a span, would be routed to Value<TRange, T>(set, T). The interceptor's Expression.Call would then throw ArgumentException at query compile. That failure is loud, but it comes from the interceptor and says nothing about the missing arm. This is the fallback-arm shape that AGENTS.md forbids for shape dispatch: a _ arm that produces a value instead of refusing.

Found by the review of PR #292 on 2026-10-19.

Change

  • Pick Value only when the operand is the set's T (its second type argument).
  • Throw for any other one-argument Contains, naming the overload that has no static form.
  • Have a test enumerate every public one-argument Contains on RangeSet<,> by reflection and check that Equivalent maps each one to a method taking that operand. A new overload then fails a test, not a query.

Release

Internal, and no answer changes. The port to release/10.x is #326.

Activity

  1. added this to the 11.0.0 milestone on Oct 19, 2026
  2. added
    choreBuild, CI, packaging, refactoring with no behaviour change
    area/range-setRangeSet and multirange algebra
    package/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQL
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/range-setRangeSet and multirange algebrachoreBuild, CI, packaging, refactoring with no behaviour changepackage/efcoreAffects CodoMetis.ValueRanges.EFCore.PostgreSQL

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions