Skip to content

Conversation

majocha
Copy link
Contributor

@majocha majocha commented Oct 11, 2025

No description provided.

@github-actions
Copy link
Contributor

❗ Release notes required

@majocha,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format.

The following format is recommended for this repository:

* <Informative description>. ([PR #XXXXX](https://github.com/dotnet/fsharp/pull/XXXXX))

See examples in the files, listed in the table below or in th full documentation at https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

You can open this PR in browser to add release notes: open in github.dev

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/11.0.0.md No release notes found or release notes format is not correct

@majocha
Copy link
Contributor Author

majocha commented Oct 13, 2025

The failing tests indicate that graph checking is not handling #load directives correctly or simply does not like script compilation mode at all?

@majocha
Copy link
Contributor Author

majocha commented Oct 14, 2025

There were two classes of errors remaining:

  • script compilation with #load directives
  • missing error FS0238 (An implementation of file or module 'E-SignatureAfterSource' has already been given)

In both cases the fix is to add graph edges:
A script file in compilation depends on any preceding sources (because we don't process the load closure into dependency graph).
An out of order sigfile depends on it's (by mistake) preceding implementation.

| None -> Array.empty
| Some sigIdx -> Array.singleton sigIdx

let wrongOrderSignature =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a lot of ugly code to deal with a single edge case, maybe can be made nicer.

[<Fact>]
let ``type check neg49`` () = singleNegTest (testConfig "typecheck/sigs") "neg49"

[<Fact>]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same test is enabled in ComponentTests now.


neg14a.fs(9,6,9,33): typecheck error FS0343: The type 'missingInterfaceInSignature' implements 'System.IComparable' explicitly but provides no corresponding override for 'Object.Equals'. An implementation of 'Object.Equals' has been automatically provided, implemented via 'System.IComparable'. Consider implementing the override 'Object.Equals' explicitly

neg14a.fs(2,8,2,11): typecheck error FS0193: Module 'Lib' requires a type 'z'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Graph checking produces more (valid) diagnostics, why?

@majocha
Copy link
Contributor Author

majocha commented Oct 14, 2025

b2.fs(1,1): error FS0239: An implementation of the file or module 'B2' has already been given

Unfortunately there is no quick way around properly handling load closure.

Comment on lines +258 to +261
// If there is a script in the project, we just process sequentially all the files that may have been added as part of the script closure.
// That means all files up to the last script file.
let scriptCompilationLength =
files |> Array.tryFindIndexBack (fun f -> f.IsScript) |> Option.map (fun idx -> idx + 1) |> Option.defaultValue 0
Copy link
Contributor Author

@majocha majocha Oct 14, 2025

Choose a reason for hiding this comment

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

Alternatively, we could just drop down to fully sequential checking in such cases.
Ideally the dependency graph should take script load closure into account but that would require more redesign. Currently sources loaded by scripts are included along with those from commandline and the information is erased in fsc.fs

@majocha majocha closed this Oct 16, 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.

1 participant