Repository navigation
fix: refuse a char compared with a number no char has - #173
Merged
Merged
Conversation
x.Grade == 65601 was stored as {Grade} = 'A': the number wrapped round to another
char, and a comparison C# answers alike for every row held for some rows only.
CharCode now refuses a code outside char's range where the lambda is written.
Closes #168
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #168
Problem
LambdaTranslator.CharCodeturned the number acharcolumn is compared with back into a char with(char)code, unchecked. A number no char has wrapped round to another one:x => x.Grade == 65601, which C# never holds, was stored as{Grade} = 'A';x.Grade > -1, which it always holds, as a comparison with U+FFFF. In awhere:the constraint held over other rows than the model declared, and nothing reported it. Found by the pre-tag review; it came with the 5.x port.Change
CharCoderefuses a code outsidechar.MinValue..char.MaxValuewithNotSupportedExceptionwhere the lambda is written (SchemaKitStrings.NotACharacter), on either side of the comparison, written or captured. A number some char has is still written as that char (x.Grade == 65→{Grade} = 'A').ParityCataloguesays why char-against-number rows stay out of the sweep and where they are held.Tests
LambdaTranslatorTests.A_char_compared_with_a_number_no_char_has_is_refused: five rows (==,<,>, operand on the left, a captured value). WithLambdaTranslator.csreverted it fails: "Expected exception of exact type NotSupportedException but no exception was thrown."A_char_is_compared_as_the_char_it_was_written_asgainsx.Grade == 65.silentinto11.0.0-preview.1: minor 0, so no### Changed answersrow; the version is unreleased.🤖 Generated with Claude Code