Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
40ded3c5
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
40ded3c5
编写于
6月 01, 2018
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix tests for declaration name completion and parameter name analysis
上级
2bec98e8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
22 deletion
+36
-22
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/DeclarationNameCompletionProviderTests_NameDeclarationInfoTests.cs
...onNameCompletionProviderTests_NameDeclarationInfoTests.cs
+16
-16
src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs
.../CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs
+5
-0
src/Features/CSharp/Portable/Diagnostics/Analyzers/CSharpNamingStyleDiagnosticAnalyzer.cs
...gnostics/Analyzers/CSharpNamingStyleDiagnosticAnalyzer.cs
+1
-0
src/Features/Core/Portable/Diagnostics/Analyzers/NamingStyleDiagnosticAnalyzerBase.cs
...iagnostics/Analyzers/NamingStyleDiagnosticAnalyzerBase.cs
+2
-3
src/Features/VisualBasic/Portable/Diagnostics/Analyzers/VisualBasicNamingStyleDiagnosticAnalyzer.vb
...ics/Analyzers/VisualBasicNamingStyleDiagnosticAnalyzer.vb
+1
-0
src/Workspaces/Core/Portable/NamingStyles/Serialization/AccessibilityExtensions.cs
...ble/NamingStyles/Serialization/AccessibilityExtensions.cs
+11
-3
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/DeclarationNameCompletionProviderTests_NameDeclarationInfoTests.cs
浏览文件 @
40ded3c5
...
...
@@ -31,7 +31,7 @@ class C
new
SymbolKindOrTypeKind
(
MethodKind
.
Ordinary
));
await
VerifyNoModifiers
(
markup
);
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -120,7 +120,7 @@ void goo()
new
SymbolKindOrTypeKind
(
MethodKind
.
LocalFunction
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -139,7 +139,7 @@ void goo()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -159,7 +159,7 @@ void goo()
new
SymbolKindOrTypeKind
(
MethodKind
.
LocalFunction
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
(
isReadOnly
:
true
));
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -178,7 +178,7 @@ void goo()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
(
isReadOnly
:
true
));
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -197,7 +197,7 @@ void M()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -216,7 +216,7 @@ void M()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -235,7 +235,7 @@ void M()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -254,7 +254,7 @@ void M()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -273,7 +273,7 @@ void M()
new
SymbolKindOrTypeKind
(
SymbolKind
.
Local
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"int"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -290,7 +290,7 @@ class C
new
SymbolKindOrTypeKind
(
SymbolKind
.
Parameter
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"global::C"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -307,7 +307,7 @@ class C
new
SymbolKindOrTypeKind
(
SymbolKind
.
Parameter
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"global::C"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -324,7 +324,7 @@ class C
new
SymbolKindOrTypeKind
(
SymbolKind
.
Parameter
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"string"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -341,7 +341,7 @@ class C
new
SymbolKindOrTypeKind
(
SymbolKind
.
Parameter
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"string"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -359,7 +359,7 @@ class C
new
SymbolKindOrTypeKind
(
SymbolKind
.
Parameter
));
await
VerifyModifiers
(
markup
,
new
DeclarationModifiers
());
await
VerifyTypeName
(
markup
,
"global::System.Collections.Generic.List<string>"
);
await
VerifyAccessibility
(
markup
,
Accessibility
.
NotApplicable
);
await
VerifyAccessibility
(
markup
,
null
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
...
...
@@ -795,7 +795,7 @@ private async Task VerifyModifiers(string markup, DeclarationModifiers modifiers
Assert
.
Equal
(
modifiers
,
result
.
Modifiers
);
}
private
async
Task
VerifyAccessibility
(
string
markup
,
Accessibility
accessibility
)
private
async
Task
VerifyAccessibility
(
string
markup
,
Accessibility
?
accessibility
)
{
var
result
=
await
GetResultsAsync
(
markup
);
Assert
.
Equal
(
accessibility
,
result
.
DeclaredAccessibility
);
...
...
src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/NamingStylesTests.cs
浏览文件 @
40ded3c5
...
...
@@ -142,6 +142,11 @@ public async Task TestPascalCaseSymbol_NoneAndDefaultSymbolKinds(string camelCas
[
InlineData
(
"int [|m|];"
,
"int M;"
,
SymbolKind
.
Field
,
Accessibility
.
Private
)]
[
InlineData
(
"event System.EventHandler [|m|];"
,
"event System.EventHandler M;"
,
SymbolKind
.
Event
,
Accessibility
.
Private
)]
[
InlineData
(
"void Outer(int [|m|]) {}"
,
"void Outer(int M) {}"
,
SymbolKind
.
Parameter
,
Accessibility
.
Private
)]
[
InlineData
(
"void Outer() { void Inner(int [|m|]) {} }"
,
"void Outer() { void Inner(int M) {} }"
,
SymbolKind
.
Parameter
,
Accessibility
.
NotApplicable
)]
[
InlineData
(
"void Outer() { System.Action<int> action = [|m|] => {} }"
,
"void Outer() { System.Action<int> action = M => {} }"
,
SymbolKind
.
Parameter
,
Accessibility
.
NotApplicable
)]
[
InlineData
(
"void Outer() { System.Action<int> action = ([|m|]) => {} }"
,
"void Outer() { System.Action<int> action = (M) => {} }"
,
SymbolKind
.
Parameter
,
Accessibility
.
NotApplicable
)]
[
InlineData
(
"void Outer() { System.Action<int> action = (int [|m|]) => {} }"
,
"void Outer() { System.Action<int> action = (int M) => {} }"
,
SymbolKind
.
Parameter
,
Accessibility
.
NotApplicable
)]
[
InlineData
(
"void Outer() { System.Action<int> action = delegate (int [|m|]) {} }"
,
"void Outer() { System.Action<int> action = delegate (int M) {} }"
,
SymbolKind
.
Parameter
,
Accessibility
.
NotApplicable
)]
[
InlineData
(
"void Outer() { int [|m|]; }"
,
"void Outer() { int M; }"
,
SymbolKind
.
Local
,
Accessibility
.
NotApplicable
)]
[
WorkItem
(
20907
,
"https://github.com/dotnet/roslyn/issues/20907"
)]
public
async
Task
TestPascalCaseSymbol_ExpectedSymbolAndAccessibility
(
string
camelCaseSymbol
,
string
pascalCaseSymbol
,
object
symbolKind
,
Accessibility
accessibility
)
...
...
src/Features/CSharp/Portable/Diagnostics/Analyzers/CSharpNamingStyleDiagnosticAnalyzer.cs
浏览文件 @
40ded3c5
...
...
@@ -16,6 +16,7 @@ internal sealed class CSharpNamingStyleDiagnosticAnalyzer : NamingStyleDiagnosti
SyntaxKind
.
CatchDeclaration
,
SyntaxKind
.
SingleVariableDesignation
,
SyntaxKind
.
LocalFunctionStatement
,
SyntaxKind
.
Parameter
,
SyntaxKind
.
TypeParameter
);
}
}
src/Features/Core/Portable/Diagnostics/Analyzers/NamingStyleDiagnosticAnalyzerBase.cs
浏览文件 @
40ded3c5
...
...
@@ -34,10 +34,9 @@ protected NamingStyleDiagnosticAnalyzerBase()
SymbolKind
.
Method
,
SymbolKind
.
NamedType
,
SymbolKind
.
Namespace
,
SymbolKind
.
Property
,
SymbolKind
.
Parameter
);
SymbolKind
.
Property
);
// Workaround: RegisterSymbolAction doesn't work with locals, local functions, or type parameters.
// Workaround: RegisterSymbolAction doesn't work with locals, local functions,
parameters,
or type parameters.
// see https://github.com/dotnet/roslyn/issues/14061
protected
abstract
ImmutableArray
<
TLanguageKindEnum
>
SupportedSyntaxKinds
{
get
;
}
...
...
src/Features/VisualBasic/Portable/Diagnostics/Analyzers/VisualBasicNamingStyleDiagnosticAnalyzer.vb
浏览文件 @
40ded3c5
...
...
@@ -13,6 +13,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Diagnostics.Analyzers
ImmutableArray
.
Create
(
SyntaxKind
.
ModifiedIdentifier
,
SyntaxKind
.
CatchStatement
,
SyntaxKind
.
Parameter
,
SyntaxKind
.
TypeParameter
)
End
Class
End
Namespace
src/Workspaces/Core/Portable/NamingStyles/Serialization/AccessibilityExtensions.cs
浏览文件 @
40ded3c5
...
...
@@ -35,9 +35,17 @@ private static Accessibility GetAccessibility(ISymbol symbol)
case
SymbolKind
.
TypeParameter
:
continue
;
case
SymbolKind
.
Method
when
((
IMethodSymbol
)
currentSymbol
).
MethodKind
==
MethodKind
.
LocalFunction
:
// Always treat local functions as 'local'
return
Accessibility
.
NotApplicable
;
case
SymbolKind
.
Method
:
switch
(((
IMethodSymbol
)
currentSymbol
).
MethodKind
)
{
case
MethodKind
.
AnonymousFunction
:
case
MethodKind
.
LocalFunction
:
// Always treat anonymous and local functions as 'local'
return
Accessibility
.
NotApplicable
;
default
:
return
currentSymbol
.
DeclaredAccessibility
;
}
default
:
return
currentSymbol
.
DeclaredAccessibility
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录