Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda9aa07

Browse files
authored
Merge pull request #5012 from Microsoft/merges/master-to-dev15.8
Merge master to dev15.8
2 parents4c4073a +e11b320 commitda9aa07

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

‎src/fsharp/fsi/fsi.fs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,7 @@ type internal FsiDynamicCompiler
11671167
// Skip the "FSI_NNNN"
11681168
match contentFile.Declarationswith
11691169
|[FSharpImplementationFileDeclaration.Entity(_eFakeModule,modDecls)]->
1170+
letcenv= SymbolEnv(newState.tcGlobals, newState.tcState.Ccu, Some newState.tcState.CcuSig, newState.tcImports)
11701171
for declin modDeclsdo
11711172
match declwith
11721173
| FSharpImplementationFileDeclaration.MemberOrFunctionOrValue(v,_,_)->
@@ -1177,16 +1178,16 @@ type internal FsiDynamicCompiler
11771178
| Item.Value vref->
11781179
letoptValue= newState.ilxGenerator.LookupGeneratedValue(valuePrinter.GetEvaluationContext(newState.emEnv), vref.Deref)
11791180
match optValuewith
1180-
| Some(res, typ)-> Some(FsiValue(res, typ, FSharpType(tcGlobals, newState.tcState.Ccu, newState.tcState.CcuSig, newState.tcImports, vref.Type)))
1181+
| Some(res, typ)-> Some(FsiValue(res, typ, FSharpType(cenv, vref.Type)))
11811182
| None-> None
11821183
|_-> None
11831184

1184-
letsymbol= FSharpSymbol.Create(newState.tcGlobals, newState.tcState.Ccu, newState.tcState.CcuSig, newState.tcImports, v.Item)
1185+
letsymbol= FSharpSymbol.Create(cenv, v.Item)
11851186
letsymbolUse= FSharpSymbolUse(tcGlobals, newState.tcState.TcEnvFromImpls.DisplayEnv, symbol, ItemOccurence.Binding, v.DeclarationLocation)
11861187
fsi.TriggerEvaluation(fsiValueOpt, symbolUse, decl)
11871188
| FSharpImplementationFileDeclaration.Entity(e,_)->
11881189
// Report a top-level module or namespace definition
1189-
letsymbol= FSharpSymbol.Create(newState.tcGlobals, newState.tcState.Ccu, newState.tcState.CcuSig, newState.tcImports, e.Item)
1190+
letsymbol= FSharpSymbol.Create(cenv, e.Item)
11901191
letsymbolUse= FSharpSymbolUse(tcGlobals, newState.tcState.TcEnvFromImpls.DisplayEnv, symbol, ItemOccurence.Binding, e.DeclarationLocation)
11911192
fsi.TriggerEvaluation(None, symbolUse, decl)
11921193
| FSharpImplementationFileDeclaration.InitAction_->

‎src/fsharp/service/service.fs‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ type TypeCheckInfo
183183
letamap= tcImports.GetImportMap()
184184
letinfoReader=new InfoReader(g,amap)
185185
letncenv=new NameResolver(g,amap,infoReader,NameResolution.FakeInstantiationGenerator)
186+
letcenv= SymbolEnv(g, thisCcu, Some ccuSigForFile, tcImports, amap, infoReader)
186187

187188
/// Find the most precise naming environment for the given line and column
188189
letGetBestEnvForPos cursorPos=
@@ -940,9 +941,9 @@ type TypeCheckInfo
940941
(fun()->
941942
match 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)->
944945
letitems=if isInterfaceFilethen items|> List.filter(fun x-> IsValidSignatureFileItem x.Item)else items
945-
letgetAccessibility item= FSharpSymbol.GetAccessibility(FSharpSymbol.Create(g, thisCcu, ccuSigForFile, tcImports, item))
946+
letgetAccessibility item= FSharpSymbol.GetAccessibility(FSharpSymbol.Create(cenv, item))
946947
letcurrentNamespaceOrModule=
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-
10171017
letitems=
10181018
// Filter out duplicate names
10191019
items|> List.map(fun(_nm,itemsWithSameName)->
10201020
match itemsWithSameNamewith
10211021
|[]-> failwith"Unexpected empty bag"
10221022
| items->
10231023
items
1024-
|> List.map(fun item->letsymbol= FSharpSymbol.Create(g, thisCcu, ccuSigForFile, tcImports, item.Item)
1024+
|> List.map(fun item->letsymbol= 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)->
11391139
letallItems= items|> List.collect(fun item-> SymbolHelpers.FlattenItems g m item.Item)
1140-
letsymbols= allItems|> List.map(fun item-> FSharpSymbol.Create(g, thisCcu, ccuSigForFile, tcImports, item))
1140+
letsymbols= allItems|> List.map(fun item-> FSharpSymbol.Create(cenv, item))
11411141
Some(symbols, denv, m)
11421142
)
11431143
(fun msg->
@@ -1251,7 +1251,7 @@ type TypeCheckInfo
12511251
match 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-
letsymbol= FSharpSymbol.Create(g, thisCcu, ccuSigForFile, tcImports, item.Item)
1254+
letsymbol= 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
14041404
member__.OpenDeclarations= openDeclarations
14051405

1406+
member__.SymbolEnv= cenv
1407+
14061408
override__.ToString()="TypeCheckInfo("+ mainInputFileName+")"
14071409

14081410
typeFSharpParsingOptions=
@@ -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
18911893
member__.GetAllUsesOfAllSymbols()=
18921894
let(tcGlobals,tcImports,thisCcu,ccuSig,tcSymbolUses,_topAttribs,_tcAssemblyData,_ilAssemRef,_ad,_tcAssemblyExpr,_dependencyFiles)= getDetails()
1895+
letcenv= SymbolEnv(tcGlobals, thisCcu, Some ccuSig, tcImports)
18931896

18941897
[|for rin tcSymbolUsesdo
18951898
for symbolUsein r.AllUsesOfSymbolsdo
18961899
if symbolUse.ItemOccurence<> ItemOccurence.RelatedTextthen
1897-
letsymbol= FSharpSymbol.Create(tcGlobals, thisCcu, ccuSig, tcImports, symbolUse.Item)
1900+
letsymbol= FSharpSymbol.Create(cenv, symbolUse.Item)
18981901
yield 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

20842087
memberinfo.GetAllUsesOfAllSymbolsInFile()=
20852088
threadSafeOp
2086-
(fun()->[||])
2087-
(fun scope->
2088-
[|for symbolUsein scope.ScopeSymbolUses.AllUsesOfSymbolsdo
2089-
if symbolUse.ItemOccurence<> ItemOccurence.RelatedTextthen
2090-
letsymbol= FSharpSymbol.Create(scope.TcGlobals, scope.ThisCcu, scope.CcuSigForFile, scope.TcImports, symbolUse.Item)
2089+
(fun()->[||])
2090+
(fun scope->
2091+
letcenv= scope.SymbolEnv
2092+
[|for symbolUsein scope.ScopeSymbolUses.AllUsesOfSymbolsdo
2093+
if symbolUse.ItemOccurence<> ItemOccurence.RelatedTextthen
2094+
letsymbol= FSharpSymbol.Create(cenv, symbolUse.Item)
20912095
yield 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
21362140
memberinfo.OpenDeclarations=
21372141
scopeOptX
21382142
|> Option.map(fun scope->
2139-
letcenv=SymbolEnv(scope.TcGlobals, scope.ThisCcu, Some scope.CcuSigForFile, scope.TcImports)
2143+
letcenv= 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

‎src/fsharp/symbols/Symbols.fs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,13 @@ type FSharpAccessibility(a:Accessibility, ?isProtected) =
4949
letmangledTextOfCompPath(CompPath(scoref,path))= getNameOfScopeRef scoref+"/"+ textOfPath(List.map fst path)
5050
String.concat";"(List.map mangledTextOfCompPath paths)
5151

52-
typeSymbolEnv(g:TcGlobals,thisCcu: CcuThunk,thisCcuTyp: ModuleOrNamespaceType option,tcImports: TcImports)=
53-
letamapV= tcImports.GetImportMap()
54-
letinfoReaderV= InfoReader(g, amapV)
52+
typeSymbolEnv(g: TcGlobals,thisCcu: CcuThunk,thisCcuTyp: ModuleOrNamespaceType option,tcImports: TcImports,amapV: Import.ImportMap,infoReaderV: InfoReader)=
53+
54+
new(g: TcGlobals, thisCcu: CcuThunk, thisCcuTyp: ModuleOrNamespaceType option, tcImports: TcImports)=
55+
letamap= tcImports.GetImportMap()
56+
letinfoReader= InfoReader(g, amap)
57+
SymbolEnv(g, thisCcu, thisCcuTyp, tcImports, amap, infoReader)
58+
5559
member__.g= g
5660
member__.amap= amapV
5761
member__.thisCcu= thisCcu
@@ -229,7 +233,7 @@ type FSharpSymbol(cenv: SymbolEnv, item: (unit -> Item), access: (FSharpSymbol -
229233
// TODO: there are several cases where we may need to report more interesting
230234
// symbol information below. By default we return a vanilla symbol.
231235
static memberCreate(g,thisCcu,thisCcuType,tcImports,item):FSharpSymbol=
232-
FSharpSymbol.Create(SymbolEnv(g, thisCcu, Some thisCcuType, tcImports), item)
236+
FSharpSymbol.Create(SymbolEnv(g, thisCcu, Some thisCcuType, tcImports), item)
233237

234238
static memberCreate(cenv,item):FSharpSymbol=
235239
letdflt()= FSharpSymbol(cenv,(fun()-> item),(fun _ _ _->true))

‎src/fsharp/symbols/Symbols.fsi‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ open System.Collections.Generic
66
openMicrosoft.FSharp.Compiler
77
openMicrosoft.FSharp.Compiler.AccessibilityLogic
88
openMicrosoft.FSharp.Compiler.CompileOps
9+
openMicrosoft.FSharp.Compiler.Import
10+
openMicrosoft.FSharp.Compiler.InfoReader
911
openMicrosoft.FSharp.Compiler.Range
1012
openMicrosoft.FSharp.Compiler.Ast
1113
openMicrosoft.FSharp.Compiler.Tast
@@ -14,8 +16,9 @@ open Microsoft.FSharp.Compiler.NameResolution
1416

1517
// Implementation details used by other code in the compiler
1618
typeinternalSymbolEnv=
17-
new: TcGlobals* thisCcu:CcuThunk* thisCcuTyp: ModuleOrNamespaceType option* tcImports: TcImports-> SymbolEnv
18-
memberamap:Import.ImportMap
19+
new: TcGlobals* thisCcu:CcuThunk* thisCcuTyp: ModuleOrNamespaceType option* tcImports: TcImports-> SymbolEnv
20+
new: TcGlobals* thisCcu:CcuThunk* thisCcuTyp: ModuleOrNamespaceType option* tcImports: TcImports* amap: ImportMap* infoReader: InfoReader-> SymbolEnv
21+
memberamap:ImportMap
1922
memberg:TcGlobals
2023

2124
/// Indicates the accessibility of a symbol, as seen by the F# language
@@ -50,8 +53,8 @@ type [<Class>] public FSharpDisplayContext =
5053
/// FSharpField, FSharpGenericParameter, FSharpStaticParameter, FSharpMemberOrFunctionOrValue, FSharpParameter,
5154
/// or FSharpActivePatternCase.
5255
type[<Class>]public FSharpSymbol=
53-
/// Internal use only.
54-
static memberinternalCreate:g:TcGlobals* thisCcu: CcuThunk* thisCcuTyp: ModuleOrNamespaceType* tcImports: TcImports*item:NameResolution.Item-> FSharpSymbol
56+
static memberinternalCreate:g:TcGlobals* thisCcu: CcuThunk* thisCcuTyp: ModuleOrNamespaceType* tcImports: TcImports* item: NameResolution.Item-> FSharpSymbol
57+
static member internal Create: cenv: SymbolEnv*item:NameResolution.Item-> FSharpSymbol
5558

5659
/// Computes if the symbol is accessible for the given accessibility rights
5760
member IsAccessible: FSharpAccessibilityRights-> bool

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp