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

Deduplicate module names in FCS #2772

Merged
merged 5 commits into from
Apr 3, 2017
Merged

Deduplicate module names in FCS #2772

merged 5 commits into from
Apr 3, 2017

Conversation

forki
Copy link
Contributor

@forki forki commented Apr 2, 2017

this ports the work of @alfonsogarciacaro from FCS back to VF#

/see also fsharp/fsharp-compiler-docs#749

@forki
Copy link
Contributor Author

forki commented Apr 2, 2017

Jus for sake of complteness. It seems fsi.exe is fine:

image

@@ -0,0 +1,13 @@
<Project Sdk="FSharp.NET.Sdk;Microsoft.NET.Sdk">
Copy link
Member

Choose a reason for hiding this comment

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

Does this test anything valuable? After all it is not using the locally built CompilerService.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about tempet.fsproj, but the tests in tests/service/ProjectAnalysisTests.fs are, I think, also being run against FSharp.LanguageService.Compiler.dll (the locally built compiler service DLL)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes it's a NUnit test that loads the proj. I think it doesn't use the sdk at all

@forki
Copy link
Contributor Author

forki commented Apr 2, 2017 via email

@alfonsogarciacaro
Copy link
Contributor

@KevinRansom The test is necessary for FCS as unfortunately the fix from #2728 didn't apply when calling FSharpChecker.ParseAndCheckProject. I don't know how the FCS tests are ported to visualfsharp, I can see that the tests files are in tests/service but the tests are not run and most of the project samples in tests/service/data are missing.

Please note the logic in this PR it's the same as in #2728 applied to a different place. Maybe we could leave a comment as a reminder to refactor both fixes to a common place in the future?

@forki
Copy link
Contributor Author

forki commented Apr 3, 2017

@alfonsogarciacaro @KevinRansom I think the fsproj file is not used at all. the test itself is in NUnit

@forki
Copy link
Contributor Author

forki commented Apr 3, 2017

ok further tracing showed that the fix actually deduped the module but it still fails in tast.fs - CombineModuleOrNamespaceTypes

so I need to do more investigation ....

@forki
Copy link
Contributor Author

forki commented Apr 3, 2017

parse D:\j\workspace\release_ci_pa---3f142ccc\tests\service/data/samename/folder1/a.fs
new D:\j\workspace\release_ci_pa---3f142ccc\tests\service/data/samename/folder1/a.fs -> A
parse D:\j\workspace\release_ci_pa---3f142ccc\tests\service/data/samename/folder2/a.fs
seen D:\j\workspace\release_ci_pa---3f142ccc\tests\service/data/samename/folder2/a.fs -> A___2
add files with same name from different folders

ERROR: Two modules named 'tempet.SayA' occur in two parts of this assembly

So it's complaing about the module SayA

lol - I didn't copy the test correctly.

image

@forki
Copy link
Contributor Author

forki commented Apr 3, 2017

Ok fixed. Ready to go in

@@ -1328,6 +1328,14 @@ type IncrementalBuilder(tcGlobals,frameworkTcImports, nonFrameworkAssemblyInputs
let StampFileNameTask (cache: TimeStampCache) _ctok (_m:range, filename:string, _isLastCompiland) =
assertNotDisposed()
cache.GetFileTimeStamp filename

// Deduplicate module names
let seen = Dictionary<string,Set<string>>()
Copy link
Contributor

Choose a reason for hiding this comment

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

@forki This duplicates the code added to fsc.fs? Could you extract this to CompileOptions.fs or CompileOps.fs and share it please? https://github.com/Microsoft/visualfsharp/blob/f6e160a2e4a375754bcf62fc3641b1861093ca3b/src/fsharp/fsc.fs#L1768

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 2fc7247

@forki
Copy link
Contributor Author

forki commented Apr 3, 2017

I also send a Pull request to @alfonsogarciacaro's PR so that both are in sync

@dsyme dsyme merged commit c044572 into dotnet:master Apr 3, 2017
@forki
Copy link
Contributor Author

forki commented Apr 3, 2017

can you please merge and release the corresponding FCS PR? It's needed for ionide ;-)

@forki forki deleted the dedupe branch April 3, 2017 13:45
@dsyme
Copy link
Contributor

dsyme commented Apr 3, 2017

yes will do

@dsyme
Copy link
Contributor

dsyme commented Apr 3, 2017

done, 12.0.3

@ThisFunctionalTom
Copy link

ThisFunctionalTom commented Apr 2, 2022

I came across same/similar issue. Here is the smallest repro I could come up with https://github.com/ThisFunctionalTom/FsxLoadBugRepro

Maybe it can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants