Skip to content

Commit 04b4d6f

Browse files
committed
fix rescoping
1 parent b27c211 commit 04b4d6f

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/fsharp/vs/Symbols.fs

+12-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ module Impl =
4141
System.Collections.ObjectModel.ReadOnlyCollection<_>(Seq.toArray arr) :> IList<_>
4242
let makeXmlDoc (XmlDoc x) = makeReadOnlyCollection (x)
4343

44-
let rescopeEntity viewedCcu (entity : Entity) =
44+
let rescopeEntity optViewedCcu (entity : Entity) =
45+
match optViewedCcu with
46+
| None -> mkLocalEntityRef entity
47+
| Some viewedCcu ->
4548
match tryRescopeEntity viewedCcu entity with
4649
| None -> mkLocalEntityRef entity
4750
| Some eref -> eref
@@ -1847,9 +1850,13 @@ and FSharpParameter(cenv, typ:TType, topArgInfo:ArgReprInfo, mOpt, isParamArrayA
18471850
override x.ToString() =
18481851
"parameter " + (match x.Name with None -> "<unnamed" | Some s -> s)
18491852

1850-
and FSharpAssemblySignature internal (cenv, topAttribs: TypeChecker.TopAttribs option, mtyp: ModuleOrNamespaceType) =
1853+
and FSharpAssemblySignature private (cenv, topAttribs: TypeChecker.TopAttribs option, optViewedCcu: CcuThunk option, mtyp: ModuleOrNamespaceType) =
18511854

1852-
new (g, thisCcu, tcImports, topAttribs, mtyp) = FSharpAssemblySignature(cenv(g, thisCcu, tcImports), topAttribs, mtyp)
1855+
// Assembly signature for a referenced/linked assembly
1856+
new (cenv, ccu: CcuThunk) = FSharpAssemblySignature((if ccu.IsUnresolvedReference then cenv else (new cenv(cenv.g, ccu, cenv.tcImports))), None, Some ccu, ccu.Contents.ModuleOrNamespaceType)
1857+
1858+
// Assembly signature for an assembly produced via type-checking.
1859+
new (g, thisCcu, tcImports, topAttribs, mtyp) = FSharpAssemblySignature(cenv(g, thisCcu, tcImports), topAttribs, None, mtyp)
18531860

18541861
member __.Entities =
18551862

@@ -1858,10 +1865,7 @@ and FSharpAssemblySignature internal (cenv, topAttribs: TypeChecker.TopAttribs o
18581865
if entity.IsNamespace then
18591866
yield! loop entity.ModuleOrNamespaceType
18601867
else
1861-
let entityRef =
1862-
match tryRescopeEntity cenv.thisCcu entity with
1863-
| None -> mkLocalEntityRef entity
1864-
| Some eref -> eref
1868+
let entityRef = rescopeEntity optViewedCcu entity
18651869
yield FSharpEntity(cenv, entityRef) |]
18661870

18671871
loop mtyp |> makeReadOnlyCollection
@@ -1885,7 +1889,7 @@ and FSharpAssembly internal (cenv, ccu: CcuThunk) =
18851889
member __.FileName = ccu.FileName
18861890
member __.SimpleName = ccu.AssemblyName
18871891
member __.IsProviderGenerated = ccu.IsProviderGenerated
1888-
member __.Contents = FSharpAssemblySignature((if ccu.IsUnresolvedReference then cenv else (new cenv(cenv.g, ccu, cenv.tcImports))), None, ccu.Contents.ModuleOrNamespaceType)
1892+
member __.Contents = FSharpAssemblySignature(cenv, ccu)
18891893

18901894
override x.ToString() = x.QualifiedName
18911895

0 commit comments

Comments
 (0)