dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.92k stars 786 forks source link

Duplicate nested module inside "module rec" gives odd error #5477

Open 0x53A opened 6 years ago

0x53A commented 6 years ago

I "accidentally" compiled a Fable project in Visual Studio :)

grafik

1>------ Build started: Project: Client, Configuration: Debug Any CPU ------
1>FSC : error FS0193: The module/namespace 'Babylonjs.BABYLON.Debug.BoneAxesViewerStatic' from compilation unit 'Client' did not contain the module/namespace '<some module on this path>'
1>error FS0193 : internal error : Der angegebene Schlüssel war nicht im Wörterbuch angegeben.
1>error FS0193 : internal error : Der angegebene Schlüssel war nicht im Wörterbuch angegeben.
An unhandled exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in FSharp.Compiler.Private.dll
Der angegebene Schlüssel war nicht im Wörterbuch angegeben.
>   FSharp.Compiler.Private.dll!Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(Microsoft.FSharp.Compiler.ErrorLogger.ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range.range m)   Unknown No symbols loaded.
    fsc.exe!Microsoft.FSharp.Compiler.CommandLineMain.main(string[] argv)   Unknown No symbols loaded.

grafik

forki commented 6 years ago

Can you please upload a repro?

Lukas Rieger notifications@github.com schrieb am Mi., 8. Aug. 2018, 11:24:

I "accidentally" compiled a Fable project in Visual Studio :)

[image: grafik] https://user-images.githubusercontent.com/4236651/43828613-4eb8df82-9afd-11e8-9889-254f2443db35.png

1>------ Build started: Project: Client, Configuration: Debug Any CPU ------ 1>FSC : error FS0193: The module/namespace 'Babylonjs.BABYLON.Debug.BoneAxesViewerStatic' from compilation unit 'Client' did not contain the module/namespace '' 1>error FS0193 : internal error : Der angegebene Schlüssel war nicht im Wörterbuch angegeben. 1>error FS0193 : internal error : Der angegebene Schlüssel war nicht im Wörterbuch angegeben.

An unhandled exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in FSharp.Compiler.Private.dll Der angegebene Schlüssel war nicht im Wörterbuch angegeben.

FSharp.Compiler.Private.dll!Microsoft.FSharp.Compiler.ErrorLogger.ErrorLoggerExtensions.ErrorLogger.ErrorRecovery(Microsoft.FSharp.Compiler.ErrorLogger.ErrorLogger x, System.Exception exn, Microsoft.FSharp.Compiler.Range.range m) Unknown No symbols loaded. fsc.exe!Microsoft.FSharp.Compiler.CommandLineMain.main(string[] argv) Unknown No symbols loaded.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Microsoft/visualfsharp/issues/5477, or mute the thread https://github.com/notifications/unsubscribe-auth/AADgNIoZOSHxPNp79GuS95MBAJDWu4mdks5uOq5jgaJpZM4VzlBs .

0x53A commented 6 years ago

not reduced repro is here: https://github.com/0x53A/fable-suave-scaffold/tree/babylon

I'll try to reduce it later, no time atm.

0x53A commented 6 years ago

single-file crash here: https://github.com/0x53A/FableBabylonCrash

cartermp commented 6 years ago

@0x53A I get the following in the reduced repro:

1>  C:\Users\phcart\AppData\Local\Temp\.NETStandard,Version=v2.0.AssemblyAttributes.fs
1>
1>  FSC : error FS0193: The module/namespace 'Babylonjs.BABYLON.Debug' from compilation unit 'FableBabylonCrash' did not contain the namespace, module or type 'BoneAxesViewerStatic'
1>Done building target "CoreCompile" in project "FableBabylonCrash.fsproj" -- FAILED.
1>
1>Done building project "FableBabylonCrash.fsproj" -- FAILED.
1>
1>Build FAILED.
1>
1>FSC : error FS0193: The module/namespace 'Babylonjs.BABYLON.Debug' from compilation unit 'FableBabylonCrash' did not contain the namespace, module or type 'BoneAxesViewerStatic'
1>    0 Warning(s)
1>    1 Error(s)
1>
1>Time Elapsed 00:00:06.76
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
0x53A commented 6 years ago

My crash was in 15.7.3, maybe it was fixed in 15.8.

I'm away from the computer for the week, will try again on Monday and reopen if it still repros.

Thanks!

0x53A commented 6 years ago

I couldn't yet update to VS 15.8 Release because my internet is shit, but I think this is still a bug.

1) (minor) I would like a line-number which points me to where BoneAxesViewerStatic is referenced. 2) The file does contain the class Babylonjs.BABYLON.Debug.BoneAxesViewerStatic.

0x53A commented 6 years ago

Ok I found the issue: there are multiple modules with the name Debug in Babylonjs.BABYLON.

So the code is incorrect, but the error is really unhelpful.

0x53A commented 6 years ago

Simplified repo:

namespace Babylonjs

module rec BABYLON =
    module Debug =
        let x = 1
    module Debug = 
        type [<AllowNullLiteral>] BoneAxesViewer = class end

        type [<AllowNullLiteral>] BoneAxesViewerStatic =
            abstract Create: float -> BoneAxesViewer

module Program =
    [<EntryPoint>]
    let main argv = 0

Expected:

error FS0037: Duplicate definition of type, exception or module 'Debug'

Actual:

1>FSC : error FS0193: The module/namespace 'Babylonjs.BABYLON.Debug.BoneAxesViewerStatic' from compilation unit 'ConsoleApp3' did not contain the module/namespace '<some module on this path>'
1>error FS0193 : internal error : The given key was not present in the dictionary.
1>error FS0193 : internal error : The given key was not present in the dictionary.

(apparently the internal error is fixed with 15.8, so ignore that)