@@ -183,6 +183,7 @@ type TypeCheckInfo
183183let amap = tcImports.GetImportMap()
184184let infoReader = new InfoReader( g, amap)
185185let ncenv = new NameResolver( g, amap, infoReader, NameResolution.FakeInstantiationGenerator)
186+ let cenv = SymbolEnv( g, thisCcu, Some ccuSigForFile, tcImports, amap, infoReader)
186187
187188/// Find the most precise naming environment for the given line and column
188189let GetBestEnvForPos cursorPos =
@@ -940,9 +941,9 @@ type TypeCheckInfo
940941( fun () ->
941942match GetDeclItemsForNamesAtPosition( ctok, parseResultsOpt, Some partialName.QualifyingIdents, Some partialName.PartialIdent, partialName.LastDotPos, line, lineStr, partialName.EndColumn+ 1 , ResolveTypeNamesToCtors, ResolveOverloads.Yes, getAllEntities, hasTextChangedSinceLastTypecheck) with
942943| None-> FSharpDeclarationListInfo.Empty
943- | Some( items, denv, ctx, m) ->
944+ | Some( items, denv, ctx, m) ->
944945let items = if isInterfaceFilethen items|> List.filter( fun x -> IsValidSignatureFileItem x.Item) else items
945- let getAccessibility item = FSharpSymbol.GetAccessibility( FSharpSymbol.Create( g , thisCcu , ccuSigForFile , tcImports , item))
946+ let getAccessibility item = FSharpSymbol.GetAccessibility( FSharpSymbol.Create( cenv , item))
946947let currentNamespaceOrModule =
947948 parseResultsOpt
948949|> Option.bind( fun x -> x.ParseTree)
@@ -1013,15 +1014,14 @@ type TypeCheckInfo
10131014
10141015 items|> List.filter( fun ( nm , items ) -> not ( isOpItem( nm, items)) && not ( isFSharpList nm))
10151016
1016-
10171017let items =
10181018// Filter out duplicate names
10191019 items|> List.map( fun ( _nm , itemsWithSameName ) ->
10201020match itemsWithSameNamewith
10211021| [] -> failwith" Unexpected empty bag"
10221022| items->
10231023 items
1024- |> List.map( fun item -> let symbol = FSharpSymbol.Create( g , thisCcu , ccuSigForFile , tcImports , item.Item)
1024+ |> List.map( fun item -> let symbol = FSharpSymbol.Create( cenv , item.Item)
10251025 FSharpSymbolUse( g, denv, symbol, ItemOccurence.Use, m)))
10261026
10271027//end filtering
@@ -1137,7 +1137,7 @@ type TypeCheckInfo
11371137| None| Some([],_,_,_) -> None
11381138| Some( items, denv, _, m) ->
11391139let allItems = items|> List.collect( fun item -> SymbolHelpers.FlattenItems g m item.Item)
1140- let symbols = allItems|> List.map( fun item -> FSharpSymbol.Create( g , thisCcu , ccuSigForFile , tcImports , item))
1140+ let symbols = allItems|> List.map( fun item -> FSharpSymbol.Create( cenv , item))
11411141 Some( symbols, denv, m)
11421142)
11431143( fun msg ->
@@ -1251,7 +1251,7 @@ type TypeCheckInfo
12511251match GetDeclItemsForNamesAtPosition( ctok, None, Some( names), None, None, line, lineStr, colAtEndOfNames, ResolveTypeNamesToCtors, ResolveOverloads.Yes,( fun () -> []), fun _ -> false ) with
12521252| None| Some([], _, _, _) -> None
12531253| Some( item:: _, denv, _, m) ->
1254- let symbol = FSharpSymbol.Create( g , thisCcu , ccuSigForFile , tcImports , item.Item)
1254+ let symbol = FSharpSymbol.Create( cenv , item.Item)
12551255 Some( symbol, denv, m)
12561256)
12571257( fun msg ->
@@ -1403,6 +1403,8 @@ type TypeCheckInfo
14031403/// All open declarations in the file, including auto open modules
14041404member __.OpenDeclarations = openDeclarations
14051405
1406+ member __.SymbolEnv = cenv
1407+
14061408override __.ToString () = " TypeCheckInfo(" + mainInputFileName+ " )"
14071409
14081410type FSharpParsingOptions =
@@ -1890,11 +1892,12 @@ type FSharpCheckProjectResults(projectFileName:string, tcConfigOption, keepAssem
18901892// Not, this does not have to be a SyncOp, it can be called from any thread
18911893member __.GetAllUsesOfAllSymbols () =
18921894let ( tcGlobals , tcImports , thisCcu , ccuSig , tcSymbolUses , _topAttribs , _tcAssemblyData , _ilAssemRef , _ad , _tcAssemblyExpr , _dependencyFiles ) = getDetails()
1895+ let cenv = SymbolEnv( tcGlobals, thisCcu, Some ccuSig, tcImports)
18931896
18941897[| for rin tcSymbolUsesdo
18951898for symbolUsein r.AllUsesOfSymbolsdo
18961899if symbolUse.ItemOccurence<> ItemOccurence.RelatedTextthen
1897- let symbol = FSharpSymbol.Create( tcGlobals , thisCcu , ccuSig , tcImports , symbolUse.Item)
1900+ let symbol = FSharpSymbol.Create( cenv , symbolUse.Item)
18981901yield FSharpSymbolUse( tcGlobals, symbolUse.DisplayEnv, symbol, symbolUse.ItemOccurence, symbolUse.Range) |]
18991902|> async.Return
19001903
@@ -2083,11 +2086,12 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
20832086
20842087member info.GetAllUsesOfAllSymbolsInFile () =
20852088 threadSafeOp
2086- ( fun () -> [| |])
2087- ( fun scope ->
2088- [| for symbolUsein scope.ScopeSymbolUses.AllUsesOfSymbolsdo
2089- if symbolUse.ItemOccurence<> ItemOccurence.RelatedTextthen
2090- let symbol = FSharpSymbol.Create( scope.TcGlobals, scope.ThisCcu, scope.CcuSigForFile, scope.TcImports, symbolUse.Item)
2089+ ( fun () -> [| |])
2090+ ( fun scope ->
2091+ let cenv = scope.SymbolEnv
2092+ [| for symbolUsein scope.ScopeSymbolUses.AllUsesOfSymbolsdo
2093+ if symbolUse.ItemOccurence<> ItemOccurence.RelatedTextthen
2094+ let symbol = FSharpSymbol.Create( cenv, symbolUse.Item)
20912095yield FSharpSymbolUse( scope.TcGlobals, symbolUse.DisplayEnv, symbol, symbolUse.ItemOccurence, symbolUse.Range) |])
20922096|> async.Return
20932097
@@ -2136,7 +2140,7 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
21362140member info.OpenDeclarations =
21372141 scopeOptX
21382142|> Option.map( fun scope ->
2139- let cenv = SymbolEnv ( scope.TcGlobals , scope.ThisCcu , Some scope.CcuSigForFile , scope.TcImports )
2143+ let cenv = scope.SymbolEnv
21402144 scope.OpenDeclarations|> Array.map( fun x -> FSharpOpenDeclaration( x.LongId, x.Range, ( x.Modules|> List.map( fun x -> FSharpEntity( cenv, x))), x.AppliedScope, x.IsOwnNamespace)))
21412145|> Option.defaultValue[| |]
21422146