Repository navigation
fix: RangeSetContains.Equivalent refuses a Contains overload it has no static form for (#320) - #434
Merged
Conversation
…o static form for (#320) Equivalent mapped a RangeSet.Contains instance method to its static form by operand type, and sent every operand that was neither the set nor an IRange<> to the value form. An overload added later, such as Contains(StringSet), would then fail in Expression.Call with an ArgumentException naming neither the overload nor the missing arm. Each overload is now matched by its exact operand type (the set, IRange<T> over the set's element, or T), and any other throws MissingArm naming it, as the translators do since #295. MissingArmTests holds it with a reflection test over every public one-argument Contains, which a new overload fails, and with an overload that does not exist. Found-By: RV Defect-Class: SQL Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 25, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #320
The interceptor half of #295 (PR #432). Its 10.x port is #326, which follows #433 (the port of #295), because the refusal here is #295's
MissingArm.Problem
RangeSetContains.Equivalentmaps aRangeSet<TRange, T>.Containsinstance method to its static form by operand type:Setwhen the operand is the set,Rangewhen it's anyIRange<>, andValuefor anything else. Only the three overloads exist today, so every answer is right. But an overload added later, such asContains(StringSet), would be routed toValue<TRange, T>(set, T). The interceptor'sExpression.Callwould then throw anArgumentExceptionat query compile that names neither the overload nor the missing arm. That's the fallback-arm shape AGENTS.md forbids, and the translator sweep from #295 doesn't reach it, because it calls the translators directly.Change
Equivalentmatches each overload by its exact operand type: the set,IRange<T>over the set's element, orT. Any other one-argumentContainsthrowsMissingArm, naming the overload and its operand type. The oldIRange<>test also accepted anIRangeover another element type.MissingArm's summary and message now cover the interceptor as well as the translators, and the message drops "in the translator". TheAGENTS.mdrule from Sweep the EF translators for name-only dispatch and default operand classification #295 namesEquivalenttoo.Internal, with no answer changes and no public API change, so there's no changelog row.
Tests
Two tests in
MissingArmTests(EF translation tests):RangeSetContains_MapsEveryOverloadToAStaticFormTakingItsOperand, overRangeSetofDateRange,Int32RangeandTimeRange: every public one-argumentContainshas a static form taking the set and that operand. This is the reflection test main:RangeSetContains.Equivalenthands any other one-argumentContainsonRangeSetto the value overload #320 asks for.RangeSetContains_WithAnOperandOfAnotherType_IsRefusedNamingIt: an overload that doesn't exist (Contains(StringSet), built as aMethodInfo) is refused, naming it.Proved three ways, with
RangeSetContains.csfrommainand the seedrangeset-overload-without-translator-arm.patchfrom #295:Full runs, locally on the .NET 11 RC2 SDK: conventions 417/417, EF translation 311/311, NodaTime EF translation 83/83, core 1,399/1,399, NodaTime 239/239, ASP.NET Core 92/92, integration on PostgreSQL 16 306/306.
🤖 Generated with Claude Code