6.0.400 compilation error with private types in namespace used in a different file
See original GitHub issueRepro steps
Defining a private type in a namespace and using it in a module in another file in the same namespace leads to a compilation error in 6.0.400.
Compiles without error in 6.0.300.
A simple repro can be found here: https://github.com/l3m/fsharp-error-repro
Expected behavior
Unclear if the behavior in 6.0.300 or 6.0.400 is the actually correct one, but it’s certainly a change.
So the expectation would have been that it compiles in 6.0.400
Actual behavior
Fails to compile in 6.0.400
Known workarounds
Replace
type private Blah = ...
with
type internal Blah = ...
Related information
Observed on both linux and windows, with dotnet sdk 6.0.300 and 6.0.400
Issue Analytics
- State:
- Created a year ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Can't see a class in the same namespace in different file at ...
But now whenever I try to compile I get a compiler error reporting that "The type or namespace name 'Data' could not be...
Read more >NuGet Restore task fails for .Net Core project migrated with ...
Afterwards the build fails with the error: ##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.
Read more >Compiler Error CS1527
In this article ... Elements defined in a namespace cannot be explicitly declared as private, protected, protected internal or private protected.
Read more >NET 6.0 - CRUD API Example and Tutorial
Tutorial on how to build a .NET 6.0 API that supports CRUD operations.
Read more >How to Reverse Engineer a Unity Game
A “-” namespace: The sample game doesn't use namespaces in its code, but other projects can have a list here of the different...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
By using this diff https://github.com/dotnet/fsharp/compare/main...dsyme:cwe?expand=1 it looks like these are the origin points for structural equality
Also this in AccessibilityLogic:
One option is to switch to
NoEquality
andNoComparison
onAccessibility
andCompilationPath
and use an explicit equality routine in the above places.Another is to use the custom equality like @nojaf above, though I think perhaps just making everything more explicit is better. There are enough notions of equality needed in the compiler its better to be explicit for anything in TypedTree
Yeah, sorry for that, was a bit unfortunate timing on our side.