-
Notifications
You must be signed in to change notification settings - Fork 796
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
Emit open namespaces, modules, types to debug data #1003
Comments
I'm working on this, but there are some additional angles to consider, I'll note them here Inside scope:
Outside of scope:
|
@vzarytovskii and I made progress on this in this branch: https://github.com/dsyme/fsharp/tree/imports |
@vzarytovskii Here are the fragments of test code for this namespace A
// TEST: implicit open of namespace A
open System
module InitCode1 =
open System.Collections.Generic
let v = Environment.HasShutdownStarted // TEST - BUG - Initialization code doesn't seem to have open declarations recorded
printfn "hello"
module InitCode2 =
open System
let v = Environment.HasShutdownStarted // TEST - BUG - Initialization code doesn't seem to have open declarations recorded
printfn "hello"
module Helpers =
let someValue = 1
let someValueRedefinedAfter = 1
[<AutoOpen>]
module AutoOpenHelpers =
let someAutoOpenValue = 1
module M =
open System.Collections.Generic
open Helpers
let f() =
System.Environment.HasShutdownStarted |> ignore // TEST
Environment.HasShutdownStarted |> ignore // TEST
someValue |> ignore // TEST
someValueRedefinedAfter |> ignore // TEST - BUG - This should show value "1"
Operators.nan |> ignore // TEST - BUG - CompiledName stuff in FSharp.Core means this doesn't work
Helpers.someValue |> ignore // TEST - BUG - no emit of implicit open of namespace A
someAutoOpenValue |> ignore // TEST - BUG - doesn't know about AutoOpen
let someValueRedefinedAfter = 0xBAAD
f()
|
Per @dsyme:
The PDB format has an entry that F# has never filled in for the "open namespaces" within a method scope. This records the active "using" statements for a piece of code. I believe this entry is used to help interpret the stuff entered into the "Watch" and "Immediate" windows of the VS debugger. So if in C# you have "using System" then you can put "Console.In" in the watch window
In F# I think this doesn't work - but only because we never fill in the "open namespaces" entry in the PDB format and write them out. I assume there is a matching "TODO" in the portable PDB and MDB debug formats. It would be good to plan ahead at this point and make sure the basic writers can emit this information, and then plumb it through fromm the type checker at a later point.
The "open namespaces" information wouldn't be too hard to propagate down. But we've just never done it.
The text was updated successfully, but these errors were encountered: