Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
4185ee3e
F
fsharp
项目概览
dotNET Platform
/
fsharp
10 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
4185ee3e
编写于
9月 06, 2023
作者:
P
Petr Pokorny
提交者:
GitHub
9月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix finding internal symbols in internals-visible-to projects (#15902)
上级
28cb3a30
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
11 deletion
+47
-11
tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs
...p.Compiler.ComponentTests/FSharpChecker/FindReferences.fs
+30
-0
tests/FSharp.Test.Utilities/ProjectGeneration.fs
tests/FSharp.Test.Utilities/ProjectGeneration.fs
+11
-7
vsintegration/src/FSharp.Editor/LanguageService/Symbols.fs
vsintegration/src/FSharp.Editor/LanguageService/Symbols.fs
+6
-4
未找到文件。
tests/FSharp.Compiler.ComponentTests/FSharpChecker/FindReferences.fs
浏览文件 @
4185ee3e
...
...
@@ -124,6 +124,36 @@ let ``Finding references in project`` (fastCheck, captureIdentifiersWhenParsing)
findAllReferencesToModuleFromFile
"File000"
fastCheck
(
expectNumberOfResults
5
)
}
[<
Fact
>]
let
``Find references to internal symbols in other projects``
()
=
let
library
=
{
SyntheticProject
.
Create
(
"Library"
,
{
sourceFile
"Library"
[]
with
Source
=
"""
namespace Lib
module internal Library =
let foo x = x + 5
[<assembly: System.Runtime.CompilerServices.InternalsVisibleTo("
FileFirst
")>]
do () """
})
with
AutoAddModules
=
false
}
let
project
=
{
SyntheticProject
.
Create
(
"App"
,
{
sourceFile
"First"
[]
with
Source
=
"""
open Lib
let bar x = Library.foo x"""
})
with
DependsOn
=
[
library
]
}
project
.
Workflow
{
placeCursor
"Library"
"foo"
findAllReferences
(
expectToFind
[
"FileFirst.fs"
,
4
,
12
,
23
"FileLibrary.fs"
,
5
,
8
,
11
])
}
[<
Fact
>]
let
``We find back-ticked identifiers``
()
=
SyntheticProject
.
Create
(
...
...
tests/FSharp.Test.Utilities/ProjectGeneration.fs
浏览文件 @
4185ee3e
...
...
@@ -441,6 +441,9 @@ let private renderFsProj (p: SyntheticProject) =
let
version
=
reference
.
Version
|>
Option
.
map
(
fun
v
->
$
" Version=
\"
{v}
\"
"
)
|>
Option
.
defaultValue
""
$
"<PackageReference Include=
\"
{reference.Name}
\"
{version}/>"
for
project
in
p
.
DependsOn
do
$
"<ProjectReference Include=
\"
{project.ProjectFileName}
\"
/>"
for
f
in
p
.
SourceFiles
do
if
f
.
HasSignatureFile
then
$
"<Compile Include=
\"
{f.SignatureFileName}
\"
/>"
...
...
@@ -1019,10 +1022,10 @@ type ProjectWorkflowBuilder
member
this
.
FindSymbolUse
(
ctx
:
WorkflowContext
,
fileId
,
symbolName
:
string
)
=
async
{
let
file
=
ctx
.
Project
.
Find
fileId
let
fileName
=
ctx
.
P
roject
.
ProjectDir
++
file
.
FileName
let
source
=
renderSourceFile
ctx
.
P
roject
file
let
options
=
ctx
.
P
roject
.
GetProjectOptions
checker
let
project
,
file
=
ctx
.
Project
.
FindInAllProjects
fileId
let
fileName
=
p
roject
.
ProjectDir
++
file
.
FileName
let
source
=
renderSourceFile
p
roject
file
let
options
=
p
roject
.
GetProjectOptions
checker
return
!
getSymbolUse
fileName
source
symbolName
options
checker
}
...
...
@@ -1072,7 +1075,6 @@ type ProjectWorkflowBuilder
member
this
.
FindAllReferences
(
workflow
:
Async
<
WorkflowContext
>,
processResults
)
=
async
{
let
!
ctx
=
workflow
let
options
=
ctx
.
Project
.
GetProjectOptions
checker
let
symbolUse
=
ctx
.
Cursor
...
...
@@ -1080,8 +1082,10 @@ type ProjectWorkflowBuilder
failwith
$
"Please place cursor at a valid location via placeCursor first"
)
let
!
results
=
[
for
f
in
options
.
SourceFiles
do
checker
.
FindBackgroundReferencesInFile
(
f
,
options
,
symbolUse
.
Symbol
,
fastCheck
=
true
)
]
[
for
p
,
f
in
ctx
.
Project
.
GetAllFiles
()
do
let
options
=
p
.
GetProjectOptions
checker
for
fileName
in
[
getFilePath
p
f
;
if
f
.
SignatureFile
<>
No
then
getSignatureFilePath
p
f
]
do
checker
.
FindBackgroundReferencesInFile
(
fileName
,
options
,
symbolUse
.
Symbol
,
fastCheck
=
true
)
]
|>
Async
.
Parallel
results
|>
Seq
.
collect
id
|>
Seq
.
toList
|>
processResults
...
...
vsintegration/src/FSharp.Editor/LanguageService/Symbols.fs
浏览文件 @
4185ee3e
...
...
@@ -24,13 +24,15 @@ type SymbolUse =
type
FSharpSymbol
with
member
this
.
IsInternalToProject
=
let
publicOrInternal
=
this
.
Accessibility
.
IsPublic
||
this
.
Accessibility
.
IsInternal
match
this
with
|
:?
FSharpParameter
->
true
|
:?
FSharpMemberOrFunctionOrValue
as
m
->
not
m
.
IsModuleValueOrMember
||
not
m
.
Accessibility
.
IsPublic
|
:?
FSharpEntity
as
m
->
not
m
.
Accessibility
.
IsPublic
|
:?
FSharpMemberOrFunctionOrValue
as
m
->
not
m
.
IsModuleValueOrMember
||
not
publicOrInternal
|
:?
FSharpEntity
->
not
publicOrInternal
|
:?
FSharpGenericParameter
->
true
|
:?
FSharpUnionCase
as
m
->
not
m
.
Accessibility
.
IsPublic
|
:?
FSharpField
as
m
->
not
m
.
Accessibility
.
IsPublic
|
:?
FSharpUnionCase
->
not
publicOrInternal
|
:?
FSharpField
->
not
publicOrInternal
|
_
->
false
type
FSharpSymbolUse
with
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录