-
Notifications
You must be signed in to change notification settings - Fork 790
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
Same file name across different folders fails the compilation with error FS0239 #2679
Comments
should work.
becaue treeview cannot render it because need to repeat folder2 twice (but vf# show a message about that) can you build from command line the project using |
I can repro.
I added a repro with new fsproj, but is fsc who complains, i checked fsc args afaik are correct. just unzip the repro
fsc arguments are right
NOTE that modules are not called 'A' and 'B', but have a namespace and distinct module name inside /cc @KevinRansom added a screenshot because now VSCode is amazing :D |
Thanks for a quick fix folks, where can I find the fixed release? |
@et1975 I've closed my fix PR because I cannot fix some tests. |
This is going to be a huge pain point for Fable if not fixed. At the moment we are merging all files (from every project) into a single project because this is the only (or at least easiest) way to get the full AST and inline functions across projects. As this is also a problem for .NET F# projects, I think it makes sense fixing it here instead of trying to find a workaround in Fable. @dsyme @forki I'm trying to continue @vasily-kirichenko PR in #2728, but I need some guidance as I don't know the F# compiler code base very well. Some questions:
|
* Simplified repro for #2679 * Fix dedupe issue in visualfsharp * fix test * Deduplicate the deduplication code * fix compile error
This still seems to be affecting VS 15.5.4 (in some cases) and ionide (in all cases) |
I have this issue with VS 2017 |
@dsyme, could you reopen this, please? And perhaps also the related PR, as @alfonsogarciacaro mentioned there, it appears the fix didn't solve the issue: fsharp/fsharp-compiler-docs#748. |
I have a way to easily replicate this:
|
@NullVoxPopuli Thanks for the repro |
As to severity. This bug strongly discourages using folders for organization. The errors generated are disruptive enough to force a change in project organization / naming strategy. P.S. |
This continues to bite me in VS 2017 and 2019. It also has a subtle display bug in the Solution Explorer when you have a subfolder named the same as another subfolder in a different path.
On the right you can see what happens if I name both subfolders "Handlers". It forces the folder to be displayed at the top even though this is not the compile order. It cannot be moved with Move Down. All the files/modules within it are differently named from the other Handlers folder. This is the compile order from the project file. It does not match the Solution Explorer display on the right. |
@edgarfgp Could this be a good topic for somebody to do in Amplifying F#, maybe? 🙂 |
Is this still a problem? Cannot reproduce that sample @enricosada made years ago. |
Thanks for suggesting this. Based on Florian comment and my own testing. It seems that is not longer reproducible. cc @vzarytovskii |
Thanks for testing things folks |
"An implementation of the file or module '%s' has already been given"
coming from:
https://github.com/Microsoft/visualfsharp/blob/d2915e6ffa0d852cb3002199e66ef83bd2e8d1d0/src/fsharp/CompileOps.fs#L5221
File is not a module and perhaps the compiler should take into account the folder it is in.
Repro steps
Create a project and organize it using following folder structure:
/folder1/a.fs
/folder1/b.fs
/folder2/a.fs
/folder2/b.fs
This kind of organization is beneficial for modelling certain problems and having to maintain different file names is a burden.
Expected behavior
It should compile.
Actual behavior
Even if the modules/namespaces defined by these files are different the compilation will still fail with FS0239
Known workarounds
Rename the files.
Related information
The text was updated successfully, but these errors were encountered: