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

Commit8e9b551

Browse files
authored
Merge pull request #5104 from Microsoft/merges/master-to-dev15.8
Merge master to dev15.8
2 parentscd20870 +86661b6 commit8e9b551

File tree

12 files changed

+135
-93
lines changed

12 files changed

+135
-93
lines changed

‎src/absil/il.fs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,8 @@ type ILTypeDef(name: string, attributes: TypeAttributes, layout: ILTypeDefLayout
19901990
extends: ILType option, methods: ILMethodDefs, nestedTypes: ILTypeDefs, fields: ILFieldDefs, methodImpls: ILMethodImplDefs,
19911991
events: ILEventDefs, properties: ILPropertyDefs, securityDeclsStored: ILSecurityDeclsStored, customAttrsStored: ILAttributesStored, metadataIndex: int32)=
19921992

1993+
let mutablecustomAttrsStored= customAttrsStored
1994+
19931995
new(name,attributes,layout,implements,genericParams,extends,methods,nestedTypes,fields,methodImpls,events,properties,securityDecls,customAttrs)=
19941996
ILTypeDef(name, attributes, layout, implements, genericParams, extends, methods, nestedTypes, fields, methodImpls, events, properties, storeILSecurityDecls securityDecls, storeILCustomAttrs customAttrs, NoMetadataIdx)
19951997

@@ -2025,7 +2027,15 @@ type ILTypeDef(name: string, attributes: TypeAttributes, layout: ILTypeDefLayout
20252027
properties= defaultArg properties x.Properties,
20262028
customAttrs= defaultArg customAttrs x.CustomAttrs)
20272029

2028-
memberx.CustomAttrs= customAttrsStored.GetCustomAttrs x.MetadataIndex
2030+
memberx.CustomAttrs=
2031+
match customAttrsStoredwith
2032+
| ILAttributesStored.Reader f->
2033+
letres= ILAttributes(f x.MetadataIndex)
2034+
customAttrsStored<- ILAttributesStored.Given res
2035+
res
2036+
| ILAttributesStored.Given res->
2037+
res
2038+
20292039
memberx.SecurityDecls= x.SecurityDeclsStored.GetSecurityDecls x.MetadataIndex
20302040

20312041
memberx.IsClass=(typeKindOfFlags x.Name x.Methods x.Fields x.Extends(int x.Attributes))= ILTypeDefKind.Class

‎src/fsharp/PrettyNaming.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ module public Microsoft.FSharp.Compiler.PrettyNaming
138138
letIsOperatorName(name:string)=
139139
letname=if name.StartsWith"("&& name.EndsWith" )"then name.[2..name.Length-3]else name
140140
// there is single operator containing a space - range operator with step: `.. ..`
141-
letres= name=".. .."|| name|> Seq.forall(fun c->opCharSet.Contains c&& c<>' ')
141+
letres= name=".. .."|| name|> Seq.forall(fun c->c<>' '&& opCharSet.Contains c)
142142
res
143143

144144
letIsMangledOpName(n:string)=

‎src/fsharp/service/ServiceAssemblyContent.fs‎

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ type AssemblySymbol =
111111
TopRequireQualifiedAccessParent:Idents option
112112
AutoOpenParent:Idents option
113113
Symbol:FSharpSymbol
114-
Kind:LookupType-> EntityKind}
114+
Kind:LookupType-> EntityKind
115+
UnresolvedSymbol:UnresolvedSymbol}
115116
overridex.ToString()= sprintf"%A" x
116117

117118
typeAssemblyPath= string
@@ -186,14 +187,33 @@ type IAssemblyContentCache =
186187
moduleAssemblyContentProvider=
187188
openSystem.IO
188189

189-
letprivatecreateEntity ns(parent:Parent)(entity:FSharpEntity)=
190+
letunresolvedSymbol(topRequireQualifiedAccessParent:Idents option)(cleanedIdents:Idents)(fullName:string)=
191+
letgetNamespace(idents:Idents)=
192+
if idents.Length>1then Some idents.[..idents.Length-2]else None
193+
194+
letns=
195+
topRequireQualifiedAccessParent
196+
|> Option.bind getNamespace
197+
|> Option.orElseWith(fun()-> getNamespace cleanedIdents)
198+
|> Option.defaultValue[||]
199+
200+
letdisplayName=
201+
letnameIdents=if cleanedIdents.Length> ns.Lengththen cleanedIdents|> Array.skip ns.Lengthelse cleanedIdents
202+
nameIdents|> String.concat"."
203+
204+
{ FullName= fullName
205+
DisplayName= displayName
206+
Namespace= ns}
207+
208+
letcreateEntity ns(parent:Parent)(entity:FSharpEntity)=
190209
parent.FormatEntityFullName entity
191210
|> Option.map(fun(fullName,cleanIdents)->
211+
lettopRequireQualifiedAccessParent= parent.TopRequiresQualifiedAccessfalse|> Option.map parent.FixParentModuleSuffix
192212
{ FullName= fullName
193213
CleanedIdents= cleanIdents
194214
Namespace= ns
195215
NearestRequireQualifiedAccessParent= parent.ThisRequiresQualifiedAccessfalse|> Option.map parent.FixParentModuleSuffix
196-
TopRequireQualifiedAccessParent=parent.TopRequiresQualifiedAccessfalse|> Option.map parent.FixParentModuleSuffix
216+
TopRequireQualifiedAccessParent=topRequireQualifiedAccessParent
197217
AutoOpenParent= parent.AutoOpen|> Option.map parent.FixParentModuleSuffix
198218
Symbol= entity
199219
Kind=fun lookupType->
@@ -208,21 +228,26 @@ module AssemblyContentProvider =
208228
match entitywith
209229
| Symbol.Attribute-> EntityKind.Attribute
210230
|_-> EntityKind.Type
231+
UnresolvedSymbol= unresolvedSymbol topRequireQualifiedAccessParent cleanIdents fullName
211232
})
212233

213-
letprivatetraverseMemberFunctionAndValues ns(parent:Parent)(membersFunctionsAndValues:seq<FSharpMemberOrFunctionOrValue>)=
234+
lettraverseMemberFunctionAndValues ns(parent:Parent)(membersFunctionsAndValues:seq<FSharpMemberOrFunctionOrValue>)=
235+
lettopRequireQualifiedAccessParent= parent.TopRequiresQualifiedAccesstrue|> Option.map parent.FixParentModuleSuffix
236+
letautoOpenParent= parent.AutoOpen|> Option.map parent.FixParentModuleSuffix
214237
membersFunctionsAndValues
215238
|> Seq.filter(fun x->not x.IsInstanceMember&&not x.IsPropertyGetterMethod&&not x.IsPropertySetterMethod)
216239
|> Seq.collect(fun func->
217240
letprocessIdents fullName idents=
241+
letcleanedIdentes= parent.FixParentModuleSuffix idents
218242
{ FullName= fullName
219-
CleanedIdents=parent.FixParentModuleSuffix idents
243+
CleanedIdents=cleanedIdentes
220244
Namespace= ns
221245
NearestRequireQualifiedAccessParent= parent.ThisRequiresQualifiedAccesstrue|> Option.map parent.FixParentModuleSuffix
222-
TopRequireQualifiedAccessParent=parent.TopRequiresQualifiedAccesstrue|> Option.map parent.FixParentModuleSuffix
223-
AutoOpenParent=parent.AutoOpen|> Option.map parent.FixParentModuleSuffix
246+
TopRequireQualifiedAccessParent=topRequireQualifiedAccessParent
247+
AutoOpenParent=autoOpenParent
224248
Symbol= func
225-
Kind=fun _-> EntityKind.FunctionOrValue func.IsActivePattern}
249+
Kind=fun _-> EntityKind.FunctionOrValue func.IsActivePattern
250+
UnresolvedSymbol= unresolvedSymbol topRequireQualifiedAccessParent cleanedIdentes fullName}
226251

227252
[yield! func.TryGetFullDisplayName()
228253
|> Option.map(fun fullDisplayName-> processIdents func.FullName(fullDisplayName.Split'.'))
@@ -241,7 +266,7 @@ module AssemblyContentProvider =
241266
processIdents(fullCompiledIdents|> String.concat".") fullCompiledIdents)
242267
|> Option.toList])
243268

244-
let recprivatetraverseEntity contentType(parent:Parent)(entity:FSharpEntity)=
269+
let rectraverseEntity contentType(parent:Parent)(entity:FSharpEntity)=
245270

246271
seq{
247272
#if!NO_EXTENSIONTYPING
@@ -308,7 +333,7 @@ module AssemblyContentProvider =
308333
|> Seq.distinctBy(fun{FullName=fullName;CleanedIdents=cleanIdents}->(fullName, cleanIdents))
309334
|> Seq.toList
310335

311-
letprivategetAssemblySignaturesContent contentType(assemblies:FSharpAssembly list)=
336+
letgetAssemblySignaturesContent contentType(assemblies:FSharpAssembly list)=
312337
assemblies|> List.collect(fun asm-> getAssemblySignatureContent contentType asm.Contents)
313338

314339
letgetAssemblyContent(withCache:(IAssemblyContentCache-> _)->_)contentType(fileName:string option)(assemblies:FSharpAssembly list)=

‎src/fsharp/service/ServiceAssemblyContent.fsi‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ type public AssemblySymbol =
5757
AutoOpenParent:Idents option
5858
Symbol:FSharpSymbol
5959
/// Function that returns `EntityKind` based of given `LookupKind`.
60-
Kind:LookupType-> EntityKind}
60+
Kind:LookupType-> EntityKind
61+
/// Cache display name and namespace, used for completion.
62+
UnresolvedSymbol:UnresolvedSymbol}
6163

6264
/// `RawEntity` list retrieved from an assembly.
6365
typeinternalAssemblyContentCacheEntry=

‎src/fsharp/service/ServiceDeclarationLists.fs‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ type FSharpDeclarationListItem(name: string, nameInCode: string, fullName: strin
548548
/// A table of declarations for Intellisense completion
549549
[<Sealed>]
550550
typeFSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[],isForType: bool,isError: bool)=
551+
static letfsharpNamespace=[|"Microsoft";"FSharp"|]
552+
551553
member__.Items= declarations
552554
member__.IsForType= isForType
553555
member__.IsError= isError
@@ -650,22 +652,26 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT
650652
| Some_-> displayName
651653
| None-> Lexhelp.Keywords.QuoteIdentifierIfNeeded displayName
652654

653-
letisAttribute= SymbolHelpers.IsAttribute infoReader item.Item
654-
655+
letisAttributeItem=lazy(SymbolHelpers.IsAttribute infoReader item.Item)
656+
655657
letcutAttributeSuffix(name:string)=
656-
if isAttributeApplicationContext&&isAttribute&&name<>"Attribute"&& name.EndsWith"Attribute"then
658+
if isAttributeApplicationContext&& name<>"Attribute"&& name.EndsWith"Attribute"&& isAttributeItem.Valuethen
657659
name.[0..name.Length-"Attribute".Length-1]
658660
else name
659661

660662
letname= cutAttributeSuffix name
661663
letnameInCode= cutAttributeSuffix nameInCode
662-
letfullName= SymbolHelpers.FullNameOfItem g item.Item
664+
665+
letfullName=
666+
match item.Unresolvedwith
667+
| Some x-> x.FullName
668+
| None-> SymbolHelpers.FullNameOfItem g item.Item
663669

664670
letnamespaceToOpen=
665671
item.Unresolved
666672
|> Option.map(fun x-> x.Namespace)
667673
|> Option.bind(fun ns->
668-
if ns|> Array.startsWith[|"Microsoft";"FSharp"|]then None
674+
if ns|> Array.startsWithfsharpNamespacethen None
669675
else Some ns)
670676
|> Option.map(fun ns->
671677
match currentNamespaceOrModulewith
@@ -676,7 +682,7 @@ type FSharpDeclarationListInfo(declarations: FSharpDeclarationListItem[], isForT
676682
| None-> ns)
677683
|> Option.bind(function
678684
|[||]-> None
679-
| ns-> Some(ns|>String.concat"."))
685+
| ns-> Some(System.String.Join(".", ns)))
680686

681687
FSharpDeclarationListItem(
682688
name, nameInCode, fullName, glyph, Choice1Of2(items, infoReader, m, denv, reactor, checkAlive), getAccessibility item.Item,

‎src/fsharp/service/service.fs‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ type TypeCheckInfo
568568
p<- p-1
569569
if p>=0then Some pelse None
570570

571-
letCompletionItem(ty:TyconRef option)(unresolvedEntity:AssemblySymbol option)(item:ItemWithInst)=
571+
letCompletionItem(ty:TyconRef option)(assemblySymbol:AssemblySymbol option)(item:ItemWithInst)=
572572
letkind=
573573
match item.Itemwith
574574
| Item.MethodGroup(_, minfo::_,_)-> CompletionItemKind.Method minfo.IsExtensionMember
@@ -579,29 +579,12 @@ type TypeCheckInfo
579579
| Item.Value_-> CompletionItemKind.Field
580580
|_-> CompletionItemKind.Other
581581

582-
letgetNamespace(idents:Idents)=
583-
if idents.Length>1then Some idents.[..idents.Length-2]else None
584-
585-
letunresolved=
586-
unresolvedEntity
587-
|> Option.map(fun x->
588-
letns=
589-
x.TopRequireQualifiedAccessParent
590-
|> Option.bind getNamespace
591-
|> Option.orElseWith(fun()-> getNamespace x.CleanedIdents)
592-
|> Option.defaultValue[||]
593-
594-
letdisplayName= x.CleanedIdents|> Array.skip ns.Length|> String.concat"."
595-
596-
{ DisplayName= displayName
597-
Namespace= ns})
598-
599582
{ ItemWithInst= item
600583
MinorPriority=0
601584
Kind= kind
602585
IsOwnMember=false
603586
Type= ty
604-
Unresolved=unresolved}
587+
Unresolved=assemblySymbol|> Option.map(fun x-> x.UnresolvedSymbol)}
605588

606589
letDefaultCompletionItem item= CompletionItem None None item
607590

@@ -1228,7 +1211,9 @@ type TypeCheckInfo
12281211
//Item.Value(vref)
12291212
None
12301213

1231-
| Item.Types(_,[AppTy g(tr,_)])whennot tr.IsLocalRef->
1214+
| Item.Types(_, TType_app(tr,_)::_)when tr.IsLocalRef&& tr.IsTypeAbbrev-> None
1215+
1216+
| Item.Types(_,[ AppTy g(tr,_)])whennot tr.IsLocalRef->
12321217
match tr.TypeReprInfo, tr.PublicPathwith
12331218
| TILObjectRepr(TILObjectReprData(ILScopeRef.Assembly assref,_,_)), Some(PubPath parts)->
12341219
letfullName= parts|> String.concat"."

‎src/fsharp/symbols/SymbolHelpers.fs‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ type CompletionItemKind =
278278
| Other
279279

280280
typeUnresolvedSymbol=
281-
{ DisplayName:string
281+
{ FullName:string
282+
DisplayName:string
282283
Namespace:string[]}
283284

284285
typeCompletionItem=
@@ -825,16 +826,16 @@ module internal SymbolHelpers =
825826
protectAssemblyExplorationtrue(fun()->
826827
match itemwith
827828
| Item.Types(it,[ty])->
829+
isAppTy g ty&&
828830
g.suppressed_types
829831
|> List.exists(fun supp->
830-
if isAppTy g ty&& isAppTy g(generalizedTyconRef supp)then
831-
// check if they are the same logical type (after removing all abbreviations)
832-
lettcr1= tcrefOfAppTy g ty
833-
lettcr2= tcrefOfAppTy g(generalizedTyconRef supp)
834-
tyconRefEq g tcr1 tcr2&&
835-
// check the display name is precisely the one we're suppressing
836-
it= supp.DisplayName
837-
elsefalse)
832+
letgeneralizedSupp= generalizedTyconRef supp
833+
// check the display name is precisely the one we're suppressing
834+
isAppTy g generalizedSupp&& it= supp.DisplayName&&
835+
// check if they are the same logical type (after removing all abbreviations)
836+
lettcr1= tcrefOfAppTy g ty
837+
lettcr2= tcrefOfAppTy g generalizedSupp
838+
tyconRefEq g tcr1 tcr2)
838839
|_->false)
839840

840841
/// Filter types that are explicitly suppressed from the IntelliSense (such as uppercase "FSharpList", "Option", etc.)

‎src/fsharp/symbols/SymbolHelpers.fsi‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ type public CompletionItemKind =
115115
| Argument
116116
| Other
117117

118-
typeinternalUnresolvedSymbol=
119-
{ DisplayName:string
118+
typeUnresolvedSymbol=
119+
{ FullName:string
120+
DisplayName:string
120121
Namespace:string[]}
121122

122123
typeinternalCompletionItem=

‎tests/scripts/compiler-perf-results.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,5 @@ https://github.com/dsyme/visualfsharp.git range1 46be8bee0
148148
https://github.com/Microsoft/visualfsharp master 284cb2ff115adb8ff5b1febe1c305a10c933172e 284cb2ff115adb8ff5b1febe1c305a10c933172e MSRC-3617253 262.07 10.58 34.79 48.58 58.51 58.31
149149
https://github.com/Microsoft/visualfsharp master 61907dcd859702924021bc0aad74f64ce459c9f0 61907dcd859702924021bc0aad74f64ce459c9f0 MSRC-3617253 254.94 10.66 37.64 47.23 57.64 58.96
150150
https://github.com/Microsoft/visualfsharp master 61907dcd859702924021bc0aad74f64ce459c9f0 61907dcd859702924021bc0aad74f64ce459c9f0 MSRC-3617253 253.14 10.05 35.05 48.81 58.62 58.47
151+
https://github.com/dsyme/visualfsharp.git minvars c7b40ab2f55cb8eb9de1be23870d503efb95debb ec46b97983e9b4bd4b5e143b8fed4dbb852d9b46 MSRC-3617253 258.28 10.24 34.64 45.21 56.01 59.46
152+
https://github.com/Microsoft/visualfsharp master ec46b97983e9b4bd4b5e143b8fed4dbb852d9b46 ec46b97983e9b4bd4b5e143b8fed4dbb852d9b46 MSRC-3617253 253.14 10.16 35.00 45.09 56.29 58.81

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp