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

Inconsistent analysis for top-level module in F# script #16986

Open
DedSec256 opened this issue Apr 4, 2024 · 1 comment
Open

Inconsistent analysis for top-level module in F# script #16986

DedSec256 opened this issue Apr 4, 2024 · 1 comment
Assignees
Labels
Area-Diagnostics mistakes and possible improvements to diagnostics Bug
Milestone

Comments

@DedSec256
Copy link
Contributor

DedSec256 commented Apr 4, 2024

In the script files, the following code is analysed in the editor without any errors

module A

let x = 3

but if you send this code to the FSI in any way (IDE, dotnet fsi file.fsx, dotnet fsi --use:file.fsx)
FS0010: Unexpected start of structured construct in definition. Expected '=' or other token. error will occur

image
image
image

Either top-level modules must be allowed in execution with fsi, or the corresponding error must be shown when analyzed in the editor.

  • .NET 8
  • Rider 2024.1 RC 1, VS Code, dotnet fsi
@github-actions github-actions bot added this to the Backlog milestone Apr 4, 2024
@Martin521
Copy link
Contributor

Namespace declaration groups and module definitions are not allowed in script fragments.
The FSharp spec (Page 298) says
script-fragment : module-elems
And module-elems is what you find inside a module.
Having said that, I have come across this issues multiple times when moving from script to project and back. But from the little that I know about the internals of fsi, I think it won't be easy to allow modules.

@abonie abonie added Area-Diagnostics mistakes and possible improvements to diagnostics and removed Needs-Triage labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Diagnostics mistakes and possible improvements to diagnostics Bug
Projects
Status: New
Development

No branches or pull requests

4 participants