Open mciccottidmg opened 2 years ago
Interesting,
namespace isn't really valid in fsx files, use module rec SomeNamespace. I can't really explain the rationale though, and I had never noticed this behaviour before.
c:\kevinransom\fsharp>copy con foo.fsx
namespace HelloWorld
^Z
1 file(s) copied.
c:\kevinransom\fsharp>dotnet fsi foo.fsx
foo.fsx(1,1): error FS0010: Unexpected keyword 'namespace' in interaction
c:\kevinransom\fsharp>
And also:
c:\kevinransom\fsharp>ue foo.fsx
c:\kevinransom\fsharp>fsc foo.fsx
Microsoft (R) F# Compiler version 12.0.4.0 for F# 6.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
foo.fsx(1,21): warning FS0988: Main module of program is empty: nothing will happen when it is run
c:\kevinransom\fsharp>fsi foo.fsx
foo.fsx(1,1): error FS0010: Unexpected keyword 'namespace' in interaction
Yeah, I wouldn't deliberately use namespaces in FSI. Its generated code though, so unfortunately I don't have a great alternative.
A file with a recursive namespace reference can't be loaded in FSI. This is similar to #237.
It does compile as part of a project.
Steps to reproduce:
module AType =
type AType2 = { AField: string }
load "test.fs"