Repository navigation
msbuild: one ordered three-valued condition judgement; certain rejections by reach (part of #1009) - #1036
Merged
Conversation
…ions by reach (part of #1009) condition::judge evaluates a condition as MSBuild does, left to right, with And and Or stopping at the operand that decides them, without the values of the names the caller is not certain of. It returns the condition's value apart from whether MSBuild may throw: never, on some values of those names (an operand it may reach whose kind can throw on some value), or whatever they hold. decide_without and decided_conjunctwise are its value, so the separate Kleene evaluation goes. The rejection judgement (judge_condition_rejection, for the conditions the property pass walks and the ones it judges unwalked) claims a rejection certain where MSBuild throws whatever the uncertain names hold, so an illegal operand reached through operands of certain value is certain whatever an operand MSBuild never reaches reads. That replaces the scan that asked every operand to be certain. A condition legal on the values the walk holds is still no site, though an operand MSBuild reaches may throw on another value of a name the walk is not certain of: judging it withdraws every project whose SDK conditions read such a name (output paths, MSBuildVersion, TFM-derived versions), so it waits on knowing what values such a name may hold. Tests pin today's verdict for those rows. Tests: judge held to evaluate under every assignment (proptest), graded against MSBuild on generated conditions over certain and uncertain operands (fixed seed and a soak), both-order rows in the rejection differentials, and unit cases in every condition position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…certain throw ends the chain Making decide_without the value of judge let an operand on trusted values we cannot evaluate (outside the grammar, or one MSBuild throws on) stand before the operand that decides the condition, so an import gate MSBuild throws on before its false conjunct excused the import, and a Directory.Build point the ordinary walker skips bypassed its fallback. judge now reports such an operand (Judgement::unevaluated), and decide_without and decided_conjunctwise decide nothing past one, as before. An operand that throws whatever the uncertain values hold now ends the chain: past one of unknown value the chain stopped with the absorbing value or throws, so no later operand is judged or probed. The never-throws claim for a plain reference is scoped to values without an item expression, which MSBuild expands from a property's value in an item's condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…grammar MSBuild reads a NaN spelling (any case, a sign, padding) as a number, and NaN equals nothing, itself included, so 'NaN' == 'NaN' is false; the evaluator's byte-equality shortcut committed true, and through it a throw after it was certified as reached. Equality on a NaN spelling now declines, graded against the oracle. A plain reference for the never-throws claim reads the property-name grammar (hyphens included), and the claim is scoped to values whose substitution forms no item expression, even across adjacent references. The judge sweep checks every never-throws claim the judgement makes outside a part it cannot evaluate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s a decision
MSBuild reads a number followed by NULs as that number ('1' == '1%00' is
true); equality now declines on a NUL, as on a NaN spelling, and an empty
operand still compares first. A sweep of equality and order over every pair
of an alphabet of .NET parsing edge spellings, graded against the oracle,
holds the committed booleans the rejection judgement certifies reach through.
decide_without and decided_conjunctwise stop at the first operand they
cannot evaluate, as their Kleene predecessor did, so no later operand is
evaluated or probed; and a rejection only possibly reached is Possible
without judging its operands. Neither puts a file the verdict does not read
into the read set. Public docs no longer link private items.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e rejection past an unevaluable operand Equality reads a NaN spelling as NaN (equal to nothing) and a number with trailing NULs as that number, rather than declining, so a comparison MSBuild decides still lets the walk see the error after it; any other NaN or NUL spelling declines. A version component of -0 is zero, as .NET reads it, so '-0.1' < '0.0.0' is false. An equality of Current against a number or version declines, since MSBuild reads $(MSBuildToolsVersion) numerically there and a literal Current as a string. The exhaustive edge-spelling sweep grows to cover each. A condition whose evaluation stops at an operand we cannot evaluate is a Possible site where, on the values the walk holds and without the file system, that operand may let MSBuild reach one it throws on. The Certain question walks no further than the first operand of unknown value (throws_whatever), so it probes no file the answer does not need. The judge census counts only uncertain names the judgement reached. The toolset row ($(MSBuildToolsVersion), which the walk holds unset) joins the pinned rows not yet judged (#1009). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…perand; decline only whole NaN spellings
A condition whose evaluation stops at an operand we cannot evaluate is
judged with the file system, since what a later operand probes can decide
whether MSBuild throws on it ('Current' != '18' And a directory compared as
a number). Equality declines only a value that is NaN but for whitespace,
signs and NULs, so a word containing nan (Finance) compares as a string.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…trinsics' implicit properties; stop at the first possible throw Equality declines where an operand reads $(MSBuildToolsVersion), which MSBuild compares as Visual Studio's version beside a number, rather than on the value Current, so a literal 'Current' != '17' is true again. A leaf that calls AreFeaturesEnabled reads MSBuildDisableFeaturesFromVersion with no reference to it, and is uncertain where that name is. The possible-rejection question past an unevaluable operand walks no further than the first operand MSBuild may throw on (may_throw), so it probes nothing past it; the property tests hold may_throw to judge. The NaN check allocates nothing. The toolset row, now judged (Possible past the declined equality), leaves the pinned rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lset and intrinsic guards judge, which only tests and test_support call, is gated, so the featureless build has no dead code; the walk asks decide_without, throws_whatever and may_throw. Equality declines only where an operand is exactly $(MSBuildToolsVersion) and the other a number or version, so a string that contains the reference compares as a string. Only a call to [MSBuild]::AreFeaturesEnabled reads MSBuildDisableFeaturesFromVersion. The judge census counts only never-throws verdicts the oracle checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ture-wave calls read their threshold The toolset-version guard declines beside anything equality may read as a number (a trailing NUL, a NaN spelling) or a version. A call to [MSBuild]::AreFeaturesEnabled reads MSBuildDisableFeaturesFromVersion however it is spaced, and only inside a property expression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s nothing; skip throw-free tails A leaf whose only uncertain read is implicit (a property expression rooted at [MSBuild]::AreFeaturesEnabled reads MSBuildDisableFeaturesFromVersion) is neither evaluated nor decided past: it may throw, and decide_without stops at it as it did before the read was recognised, so an import gate it precedes is not ruled out. Only a property expression rooted at the intrinsic counts. The possible-throw walk evaluates no operand that cannot throw and gates none that can, so a trailing Exists is not probed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ow; word possible condition rejections as possible The possible-throw walk finds each chain's last operand that can throw once, rather than rescanning the rest at every operand (quadratic on long flat chains), and a standalone boolean literal is one that cannot. A Possible IllegalCondition now says MSBuild may reach an operand it cannot evaluate; only a Certain one says it cannot evaluate the condition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a real opener, and treat quoted booleans as throw-free Equality compares no versions, so the toolset-version guard declines only beside what equality may read as a number. The implicit feature-wave read needs a contiguous property-expression opener before the intrinsic. A quoted boolean literal standing alone cannot throw, so the possible-throw walk prunes it as it does an unquoted one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e condition rejection for both failures The implicit-read scan compares each property-expression opener against the intrinsic's name character by character, so an operand of many references costs a pass, not one per reference (111 s to 1 s on 40,000). A possible IllegalCondition says MSBuild may be unable to evaluate the condition, which covers an operand it may reach and a syntax error behind a gate it may take. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…overage floors; pin the unmodelled call apart The possible-throw walk classifies a leaf of literals by its evaluation (1 < 2 cannot throw), so a trailing literal comparison no longer makes it probe an Exists before it. The random coverage floors of the judgement property sit where any seed meets them. The pinned rows separate the conditions legal on the values the walk holds (#1009) from a property function MSBuild throws on that the walk does not model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Classifying a leaf of literals by its evaluation without the file system
pruned one that throws only once the Unix path adjustment has its say
(HasTrailingSlash('/tmp\a;b'), two items), so the walk missed a rejection
MSBuild makes. The walk prunes by kind alone again; a literal comparison
past an Exists costs that probe.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… version component Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of #1009.
What
One primitive for MSBuild's condition order,
condition::judge. It evaluates a condition as MSBuild does: left to right, withAnd/Orstopping at the operand that decides them, and without the values of the names the caller is not certain of. It reports the condition's value separately from whether MSBuild may throw:Never: no throw;Maybe: a throw cannot be ruled out, because an operand MSBuild may reach can throw on some value;Certainly: MSBuild throws whatever the uncertain names hold.judgesits behindtest-support. The walk asks three narrower questions, each built on the same core and stopping as soon as it has its answer:decide_without(value commits), withdecided_conjunctwisebuilt on it;throws_whatever(certain rejections);may_throw(possible rejections).The separate Kleene evaluator (
eval_kleene,kleene_chain) andrejected_by_syntaxare deleted.The rejection judgement (
judge_condition_rejection) covers the conditions the property pass walks and the onesjudge_textjudges unwalked:Condition-evaluator fixes found on the way
Each of these was a wrong committed boolean (or a wrongly declined one), graded by a new exhaustive edge-spelling oracle sweep:
'NaN' == 'NaN'is false in MSBuild, which reads a NaN spelling as a number. It is modelled now; other NaN spellings decline.'1' == '1%00'is true, since MSBuild reads trailing NULs as part of the number. Modelled; a NUL elsewhere declines.-0is a valid version component, so'-0.1' < '0.0.0'is false.$(MSBuildToolsVersion)and the other a number declines, because MSBuild reads itsCurrentas Visual Studio's version.[MSBuild]::AreFeaturesEnabledreadsMSBuildDisableFeaturesFromVersionwithout naming it. That name is now counted.IllegalConditionnow says MSBuild may be unable to evaluate the condition.Tests
judgeheld toevaluateunder every assignment of the uncertain names (proptest).may_throwandthrows_whateverare held to it too.judge_sweep: generated conditions over certain and uncertain operands, including property-function operands, graded against the MSBuild oracle. The value must be certain-implies-exact, the walk must never claim "cannot throw" where MSBuild throws, and it may claim "certainly throws" only where MSBuild always does. Runs a fixed seed, plus a soak.comparisons_of_edge_spellings_are_certain_implies_exact: equality and order over every pair from an alphabet of .NET parse edge cases, graded against the oracle.!, function-call operands, NaN/NUL/-0/toolset short circuits, and filesystem-dependent operands. Rows the walk does not yet judge are pinned.Movement
No manifest moves:
fsproj_msbuild_corpus_diffand every project-corpus-gate step are unchanged.Gates (head f732020)
fmt, workspace clippy, workspace doc, the featureless
borzoi-msbuildclippy/doc pair,fsproj_msbuild_corpus_diff,sdk_chain_decline_attribution, andproject-corpus-gate.sh(all 7 steps) all exit 0.Workspace
cargo testwas run on ea98ff1, which differs from this head only in doc comments. Everything passed exceptwalk_cost_scaling::every_flat_repetition_walks_in_linear_time(a sema timing test, load average about 128), which passed when re-run alone.Codex: 16 rounds. The last is clean.
🤖 Generated with Claude Code