Repository navigation
Checker: fix overload cache key collisions - #21025
Open
auduchinok wants to merge 1 commit into
Open
auduchinok wants to merge 1 commit into
auduchinok wants to merge 1 commit into
Conversation
Contributor
✅ Release notes checked
|
The overload resolution cache keyed a call by a summary of its argument types and candidates, so a call could get the method chosen for a different call. It missed explicit type arguments, the instantiation of the declaring type, method type arguments already solved while checking the arguments, tuple and function nesting, type parameters, units of measure, nullness and conversions declared later in the file. A hit also returned the method without the warnings and the trace a full resolution gives. The key is now everything resolution reads, written as one exact token sequence. A call that cannot be written exactly is not cached. A hit checks the cached method again the way the full resolution found it, so it returns the same warnings and trace, and falls back to full resolution if the method no longer applies. Types of the file being checked are keyed together with the number of members and interfaces the file has published so far, and not cached while type definitions are being established. A result is not stored when resolution reported a diagnostic directly or looked up a conversion that depends on the caller's access rights. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
auduchinok
force-pushed
the
checker-overloadCacheTyArgs
branch
from
November 24, 2026 16:30
d725514 to
5522900
Compare
abonie
reviewed
Nov 27, 2026
abonie
left a comment
Member
There was a problem hiding this comment.
🤖🕵️ AI review — verify independently.
|
|
||
| member _.AddType(ty: TType) = | ||
| if not ctx.IsRejected then | ||
| emitTType ctx ty |
Member
There was a problem hiding this comment.
🤖🕵️ Different anonymous-record types share this stamp — the cached obj overload makes the second call fail with FS0193.
// Compile as TypeEncodingLibā漢.dll
module CrossLibOne
let first = {| D = 1 |}
// Compile as TypeEncodingLib.dll
module CrossLibTwo
let second = {| ``∁ůD`` = 1 |}
type Overloaded =
static member Pick(x: obj) = "object"
static member Pick(x: {| ``∁ůD``: int |}) = 2
// Consumer referencing both DLLs
module CrossLibConsumer
let a: string = CrossLibTwo.Overloaded.Pick CrossLibOne.first
let b: int = CrossLibTwo.Overloaded.Pick CrossLibTwo.secondBoth producer DLLs emit on base and PR. The exact base compiler also emits the consumer; this PR adds FS0193 at the second call. Both versions report the same existing FS3186 metadata warnings. These assembly/field-name combinations produce the same stamp despite different semantic types; encode the actual assembly identity and field names rather than their hashed stamp.
This branch has not been deployed
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.
The overload resolution cache keyed a call by a summary of its argument types and candidates, so a call could get the method chosen for a different call. Which call was resolved first decided the result. This is flaky and sometimes leads to FS0193 in CI.
The key is now everything resolution reads, written as one exact token sequence; a call that cannot be written exactly is not cached. A hit checks the cached method again the way the full resolution found it, so it reports the same warnings as a miss.