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

Commit542d754

Browse files
vasily-kirichenkoKevinRansom
authored andcommitted
Fix unused opens analyzer for shorten fsharp core namespaces (#2944)
@Vasily,Thank you* ready
1 parent02731ef commit542d754

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

‎src/fsharp/vs/Symbols.fs‎

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
218218
letisResolved()=not(isUnresolved())
219219
letcheckIsResolved()= checkEntityIsResolved entity
220220

221+
letisDefinedInFSharpCore()=
222+
match ccuOfTyconRef entitywith
223+
| None->false
224+
| Some ccu-> ccuEq ccu cenv.g.fslibCcu
225+
221226
member__.Entity= entity
222227

223228
member__.LogicalName=
@@ -520,16 +525,35 @@ and FSharpEntity(cenv:cenv, entity:EntityRef) =
520525

521526
member__.AllCompilationPaths=
522527
checkIsResolved()
523-
let(CompilationPath.CompPath(_,parts))= entity.CompilationPath
524-
([], parts)||> List.fold(fun res(part,kind)->
525-
letparts=
526-
match kindwith
527-
| ModuleOrNamespaceKind.FSharpModuleWithSuffix->
528-
[part; part.[..part.Length-7]]
529-
|_->[part]
530-
531-
parts|> List.collect(fun part->
532-
res|> List.map(fun path-> path+"."+ part)))
528+
let(CompPath(_,parts))= entity.CompilationPath
529+
letpartsList=
530+
[yield parts
531+
match partswith
532+
|("Microsoft", ModuleOrNamespaceKind.Namespace):: restwhen isDefinedInFSharpCore()->yield rest
533+
|_->()]
534+
535+
letmapEachCurrentPath(paths:string list list)path=
536+
match pathswith
537+
|[]->[[path]]
538+
|_-> paths|> List.map(fun x-> path:: x)
539+
540+
letwalkParts(parts:(string* ModuleOrNamespaceKind)list)=//: string list list =
541+
let recloop(currentPaths:string list list)parts=
542+
match partswith
543+
|[]-> currentPaths
544+
|(name: string, kind):: rest->
545+
match kindwith
546+
| ModuleOrNamespaceKind.FSharpModuleWithSuffix->
547+
[yield! loop(mapEachCurrentPath currentPaths name) rest
548+
yield! loop(mapEachCurrentPath currentPaths(name.[..name.Length-7])) rest]
549+
|_->
550+
loop(mapEachCurrentPath currentPaths name) rest
551+
loop[] parts|> List.map(List.rev>> String.concat".")
552+
553+
letres=
554+
[for partsin partsListdo
555+
yield! walkParts parts]
556+
res
533557

534558
overridex.Equals(other:obj)=
535559
box x=== other||

‎vsintegration/src/FSharp.Editor/Diagnostics/UnusedOpensDiagnosticAnalyzer.fs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ module private UnusedOpens =
6767
[yield ent.Namespace
6868
yield Some ent.AccessPath
6969
yield getAutoOpenAccessPath ent
70-
//for path in ent.AllCompilationPaths do
71-
// yield Some path
70+
for pathin ent.AllCompilationPathsdo
71+
yield Some path
7272
]
7373
| None->[]
7474

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp