Non deterministic edge case with parallel reference resolution
I'm investigating the feasibility of enabling some of the parallelizations by default.
Now, with parallelReferenceResolution on, there is a test failure in https://github.com/dotnet/fsharp/blob/601a68970ab7c076ead06737657dc3a7c68313a3/tests/FSharp.Compiler.ComponentTests/Conformance/BasicGrammarElements/ModuleDefinitions/ModuleDefinitions.fs#L307
What the test does is simply reference two assemblies that define the same type (namespace and all).
Now, the expected result appears to be that the order of referencing makes one type shadow another. This randomly fails with parallel resolution, because of undetermined order. Also this does not seem optimal tbh, I'd expect at least a warning of some kind?
The internet says C# in the same situation will fail the compilation and require extern alias to disambiguate the types.
I wonder, if F# behavior in this case is specified and expected? The existence of a test suggest so.
It works like any other shadowing, even though it is likely not explicitly described in that level of detail as the test demonstrates. Since nowadays many compilation units also emit compiler-generated types, especially attributes, in the exact same namespace - it is unlikely we would want to have this as an error.
When it comes to parallel reference resolution, the behavior should stay and follow the shadowing rules - can this be accomplished by divide (in parallel) & conquer (sequentially, follow shadowing rules perharps?