Skip to content

Conversation

majocha
Copy link
Contributor

@majocha majocha commented Oct 16, 2025

Description

This is a speculative fix for #19007

We should not try to get a cache key out of an infinite type.

This adds a failsafe for such cases.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.0.md

@majocha majocha marked this pull request as ready for review October 16, 2025 14:22
@majocha majocha requested a review from a team as a code owner October 16, 2025 14:22
@majocha
Copy link
Contributor Author

majocha commented Oct 16, 2025

Unfortunately,, I can't come up with a test case that would repro the issue.

@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Oct 16, 2025
@T-Gro
Copy link
Member

T-Gro commented Oct 16, 2025

I think it would make sense to re-target this to release/dev18.0 and backport, if there is a real chance of it happening for regular projects.

@majocha
Copy link
Contributor Author

majocha commented Oct 16, 2025

I think it would make sense to re-target this to release/dev18.0 and backport, if there is a real chance of it happening for regular projects.

In the repo from the issue it happens during edits, i.e. the code is not in the state that compiles correctly.
This makes some sense now to me why this could happen. There is the occursCheck that checks for invalid "infinite" types, but various type relation calls can very well happen before that check.

@majocha majocha closed this Oct 17, 2025
@majocha majocha reopened this Oct 17, 2025
@T-Gro
Copy link
Member

T-Gro commented Oct 17, 2025

Understood.
It would be great if we could get piece of that invalid code as an regression test.

@T-Gro T-Gro merged commit 0ccadb9 into dotnet:main Oct 17, 2025
40 checks passed
@majocha
Copy link
Contributor Author

majocha commented Oct 17, 2025

Understood. It would be great if we could get piece of that invalid code as an regression test.

Yeah, tbh I tried a lot of hand crafted and copilot generated code but it all behaves ok. None of the unsolved types hitting getTypeStructure were "infinite":
image
I'm starting to think this is a red herring and a problem lies somewhere else completely, yet to show up. Sigh.

@T-Gro
Copy link
Member

T-Gro commented Oct 17, 2025

Maybe one of the cases found in issues ( #9523 , #11239 ) or in code comments like type a = a list ?

@T-Gro
Copy link
Member

T-Gro commented Oct 20, 2025

@github-actions
Copy link
Contributor

@T-Gro backporting to "release/dev18.0" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Add a failsafe in case of infinite types
Applying: do not cache when invalid keys
Applying: refactor
Applying: rn
.git/rebase-apply/patch:13: trailing whitespace.
* Type relations cache: handle potentially "infinite" types ([PR #19010](https://github.com/dotnet/fsharp/pull/19010))  
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M	docs/release-notes/.FSharp.Compiler.Service/11.0.0.md
Falling back to patching base and 3-way merge...
Auto-merging docs/release-notes/.FSharp.Compiler.Service/11.0.0.md
CONFLICT (content): Merge conflict in docs/release-notes/.FSharp.Compiler.Service/11.0.0.md
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0004 rn
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@dotnet dotnet deleted a comment from github-actions bot Oct 21, 2025
@dotnet dotnet deleted a comment from github-actions bot Oct 21, 2025
@dotnet dotnet deleted a comment from github-actions bot Oct 21, 2025
T-Gro added a commit that referenced this pull request Oct 22, 2025
T-Gro added a commit that referenced this pull request Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants