Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Internal error when analysing incomplete inherit member #17905

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Oct 21, 2024

Description

Fixes #17902

Checklist

  • Test cases added
  • Release notes entry updated

Copy link
Contributor

github-actions bot commented Oct 21, 2024

❗ 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/9.0.200.md

@@ -37,7 +37,7 @@ type SynLongIdent =

member this.Range =
match this with
| SynLongIdent([], _, _) -> failwith "rangeOfLidwd"
| SynLongIdent([], _, _) -> Range.Zero
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may be a not good fix here, because it affects to many different places where this type is used. The exception immediately shows that something is really wrong, and a wrong range may go unnoticed for a long time.

It's probably much better to fix it more systematically (e.g. use SynLongIdent option instead of SynLongIdent in places of known recovery) and/or check it in the outer code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Range.Zero is commonly used in similar scenarios in the SyntaxTree file. But I agree we could use option here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Range.Zero is commonly used in similar scenarios in the SyntaxTree file.

Well, that's wrong because it means some node with a range like (10,20)-(10,30) can now contain a node with range (0, 0)-(0, 0) which is outside of its parent node range. Anyway, we need to fix this more systematically in future.

Copy link
Contributor

@brianrourkeboll brianrourkeboll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: I generally think keeping pattern matching flat where possible (instead of adding nested match expressions) makes the top-level match easier to understand, but feel free to ignore if you disagree.

src/Compiler/Service/ServiceParseTreeWalk.fs Outdated Show resolved Hide resolved
src/Compiler/Driver/GraphChecking/FileContentMapping.fs Outdated Show resolved Hide resolved
src/Compiler/Service/ServiceParsedInputOps.fs Outdated Show resolved Hide resolved
src/Compiler/Service/ServiceParsedInputOps.fs Outdated Show resolved Hide resolved
@edgarfgp edgarfgp force-pushed the fix-17902 branch 3 times, most recently from 878597e to 362bdfc Compare October 22, 2024 15:07
@edgarfgp
Copy link
Contributor Author

@psfinaki Sorry to bother you again. Could you help me update the last salsa test https://dev.azure.com/dnceng-public/public/_build/results?buildId=850191&view=ms.vss-test-web.build-test-results-tab&runId=22075436&resultId=108303&paneView=debug. Trying to do it using the CI is really painful :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: New
Development

Successfully merging this pull request may close these issues.

Internal error when analyzing incomplete inherit member
3 participants