Description
When having module name clashes, namespacing is important.
For example, you have two modules named "Foo" in the same F# assembly. If you place them under namespaces Bar.Foo and Baz.Foo, the compiler is happy.
However, normally developers try to mimic directory-file name structures to map exactly with namespace-type ones. In this case, the F# compiler is not helping, because placing two Foo.fs for the same project, even if in different directories Bar\Foo.fs
and Baz\Foo.fs
, it gives this error:
error FS0239: An implementation of the file or module 'Foo' has already been given
Repro steps
- Have an F# project with 2 modules
Foo
: one namespacedBar.Foo
(BarFoo.fs) and the otherBaz.Foo
(BazFoo.fs). - F# compiler compiles the project succesfully.
- Move BarFoo.fs to a subfolder
Bar
and rename the file toFoo.fs
. - Move BazFoo.fs to a subfolder
Baz
and rename the file toFoo.fs
. - Try to compile again.
Expected behavior
F# compiler should succeed.
Actual behavior
error FS0239: An implementation of the file or module 'Foo' has already been given
Known workarounds
Rename files to redundant names such as BarFoo.fs and BazFoo.fs (even if they're already in Bar and Baz directories).
Related information
Provide any related information
- Windows8
- .NET 4.5.1
- VisualStudio 2017
- F# 4.1