Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
478fdbf3
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,发现更多精彩内容 >>
提交
478fdbf3
编写于
4月 19, 2020
作者:
S
Sam Harwell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove several unnecessary obsolete methods
上级
e7123fbe
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
54 deletion
+16
-54
src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs
...p/Tests/ValidateFormatString/ValidateFormatStringTests.cs
+11
-10
src/Analyzers/VisualBasic/Tests/ValidateFormatString/ValidateFormatStringTests.vb
...c/Tests/ValidateFormatString/ValidateFormatStringTests.vb
+5
-12
src/CodeStyle/CSharp/Tests/AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest_OptionHelpers.cs
...iagnosticProviderBasedUserDiagnosticTest_OptionHelpers.cs
+0
-5
src/CodeStyle/VisualBasic/Tests/AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest_OptionHelpers.vb
...iagnosticProviderBasedUserDiagnosticTest_OptionHelpers.vb
+0
-5
src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest_OptionHelpers.cs
...s/AbstractCodeActionOrUserDiagnosticTest_OptionHelpers.cs
+0
-8
src/Workspaces/CoreTestUtilities/OptionsCollection.cs
src/Workspaces/CoreTestUtilities/OptionsCollection.cs
+0
-14
未找到文件。
src/Analyzers/CSharp/Tests/ValidateFormatString/ValidateFormatStringTests.cs
浏览文件 @
478fdbf3
...
...
@@ -8,7 +8,6 @@
using
Microsoft.CodeAnalysis.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Diagnostics
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
;
using
Microsoft.CodeAnalysis.Options
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Microsoft.CodeAnalysis.ValidateFormatString
;
using
Roslyn.Test.Utilities
;
...
...
@@ -21,15 +20,17 @@ public class ValidateFormatStringTests : AbstractCSharpDiagnosticProviderBasedUs
internal
override
(
DiagnosticAnalyzer
,
CodeFixProvider
)
CreateDiagnosticProviderAndFixer
(
Workspace
workspace
)
=>
(
new
CSharpValidateFormatStringDiagnosticAnalyzer
(),
null
);
#pragma warning disable CS0618 // Type or member is obsolete
private
OptionsCollection
CSharpOptionOffVBOptionOn
()
=>
OptionsSet
(
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
false
),
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
true
));
private
OptionsCollection
OptionOff
()
=>
new
OptionsCollection
(
GetLanguage
())
{
{
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
false
},
};
private
OptionsCollection
CSharpOptionOnVBOptionOff
()
=>
OptionsSet
(
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
true
),
(
new
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
false
));
#pragma warning restore CS0618 // Type or member is obsolete
private
OptionsCollection
OptionOn
()
=>
new
OptionsCollection
(
GetLanguage
())
{
{
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
true
},
};
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)]
public
async
Task
OnePlaceholder
()
...
...
@@ -554,7 +555,7 @@ static void Main(string[] args)
string.Format(""This [|{1}|] is my test"", ""teststring1"");
}
}"
;
var
options
=
optionOn
?
CSharpOptionOnVBOptionOff
()
:
CSharpOptionOffVBOptionOn
();
var
options
=
optionOn
?
OptionOn
()
:
OptionOff
();
if
(!
expectDiagnostic
)
{
await
TestDiagnosticMissingAsync
(
source
,
new
TestParameters
(
options
:
options
));
...
...
src/Analyzers/VisualBasic/Tests/ValidateFormatString/ValidateFormatStringTests.vb
浏览文件 @
478fdbf3
...
...
@@ -6,7 +6,6 @@ Imports Microsoft.CodeAnalysis.CodeFixes
Imports
Microsoft.CodeAnalysis.Diagnostics
Imports
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
Imports
Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Imports
Microsoft.CodeAnalysis.Options
Imports
Microsoft.CodeAnalysis.ValidateFormatString
Imports
Microsoft.CodeAnalysis.VisualBasic.ValidateFormatString
...
...
@@ -19,19 +18,13 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ValidateFormatStri
Return
(
New
VisualBasicValidateFormatStringDiagnosticAnalyzer
,
Nothing
)
End
Function
#
Disable
Warning
BC40000
' Type or member is obsolete
Private
Function
VBOptionOnCSharpOptionOff
()
As
OptionsCollection
Return
OptionsSet
(
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
False
),
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
True
))
Private
Function
OptionOn
()
As
OptionsCollection
Return
New
OptionsCollection
(
GetLanguage
())
From
{{
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
True
}}
End
Function
Private
Function
VBOptionOffCSharpOptionOn
()
As
OptionsCollection
Return
OptionsSet
(
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
CSharp
),
True
),
(
New
OptionKey2
(
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
LanguageNames
.
VisualBasic
),
False
))
Private
Function
OptionOff
()
As
OptionsCollection
Return
New
OptionsCollection
(
GetLanguage
())
From
{{
ValidateFormatStringOption
.
ReportInvalidPlaceholdersInStringDotFormatCalls
,
False
}}
End
Function
#
Enable
Warning
BC40000
' Type or member is obsolete
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
ValidateFormatString
)
>
Public
Async
Function
ParamsObjectArray
()
As
Task
...
...
@@ -303,7 +296,7 @@ Class C
string.Format(
""
This {0} [|{2}|] works
""
,
""
test
""
,
""
also
""
)
End Sub
End Class"
Dim
options
=
If
(
optionOn
,
VBOptionOnCSharpOptionOff
(),
VBOptionOffCSharpOptionOn
())
Dim
options
=
If
(
optionOn
,
Me
.
OptionOn
(),
OptionOff
())
If
Not
expectDiagnostic
Then
Await
TestDiagnosticMissingAsync
(
source
,
New
TestParameters
(
options
:
=
options
))
Else
...
...
src/CodeStyle/CSharp/Tests/AbstractCSharpDiagnosticProviderBasedUserDiagnosticTest_OptionHelpers.cs
浏览文件 @
478fdbf3
...
...
@@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using
System
;
using
Microsoft.CodeAnalysis.CodeStyle
;
using
Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions
;
using
Microsoft.CodeAnalysis.Options
;
...
...
@@ -49,9 +48,5 @@ internal OptionsCollection Option<T>(Option2<T> option, T value)
internal
OptionsCollection
Option
<
T
>(
PerLanguageOption2
<
T
>
option
,
T
value
)
=>
new
OptionsCollection
(
GetLanguage
())
{
{
option
,
value
}
};
[
Obsolete
(
"Use a strongly-typed overload instead."
)]
internal
OptionsCollection
OptionsSet
(
params
(
OptionKey2
key
,
object
value
)[]
options
)
=>
new
OptionsCollection
(
LanguageNames
.
CSharp
,
options
);
}
}
src/CodeStyle/VisualBasic/Tests/AbstractVisualBasicDiagnosticProviderBasedUserDiagnosticTest_OptionHelpers.vb
浏览文件 @
478fdbf3
...
...
@@ -60,10 +60,5 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Diagnostics
Friend
Function
[
Option
]
(
Of
T
)(
optionParam
As
PerLanguageOption2
(
Of
T
),
value
As
T
)
As
OptionsCollection
Return
New
OptionsCollection
(
GetLanguage
())
From
{{
optionParam
,
value
}}
End
Function
<
Obsolete
(
"Use a strongly-typed overload instead."
)
>
Friend
Shared
Function
OptionsSet
(
ParamArray
options
As
(
OptionKey2
,
Object
)())
As
OptionsCollection
Return
New
OptionsCollection
(
LanguageNames
.
VisualBasic
,
options
)
End
Function
End
Class
End
Namespace
src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionOrUserDiagnosticTest_OptionHelpers.cs
浏览文件 @
478fdbf3
...
...
@@ -50,13 +50,5 @@ internal OptionsCollection Option<T>(PerLanguageOption2<T> option, T value)
internal
OptionsCollection
Option
<
T
>(
PerLanguageOption2
<
CodeStyleOption2
<
T
>>
option
,
CodeStyleOption2
<
T
>
codeStyle
)
=>
new
OptionsCollection
(
GetLanguage
())
{
{
option
,
codeStyle
}
};
[
Obsolete
(
"Use a strongly-typed overload instead."
)]
internal
OptionsCollection
OptionsSet
(
OptionKey2
option
,
object
value
)
=>
OptionsSet
((
option
,
value
));
[
Obsolete
(
"Use a strongly-typed overload instead."
)]
internal
OptionsCollection
OptionsSet
(
params
(
OptionKey2
key
,
object
?
value
)[]
options
)
=>
new
OptionsCollection
(
GetLanguage
(),
options
:
options
);
}
}
src/Workspaces/CoreTestUtilities/OptionsCollection.cs
浏览文件 @
478fdbf3
...
...
@@ -23,16 +23,6 @@ public OptionsCollection(string languageName)
_languageName
=
languageName
;
}
[
Obsolete
(
"Use a strongly-typed overload instead."
)]
public
OptionsCollection
(
string
languageName
,
params
(
OptionKey2
key
,
object
?
value
)[]
options
)
:
this
(
languageName
)
{
foreach
(
var
(
key
,
value
)
in
options
)
{
Add
(
key
,
value
);
}
}
public
string
DefaultExtension
=>
_languageName
==
LanguageNames
.
CSharp
?
"cs"
:
"vb"
;
public
int
Count
=>
_options
.
Count
;
...
...
@@ -52,10 +42,6 @@ public void Add<T>(PerLanguageOption2<CodeStyleOption2<T>> option, T value)
public
void
Add
<
T
>(
PerLanguageOption2
<
CodeStyleOption2
<
T
>>
option
,
T
value
,
NotificationOption2
notification
)
=>
_options
.
Add
(
new
OptionKey2
(
option
,
_languageName
),
new
CodeStyleOption2
<
T
>(
value
,
notification
));
[
Obsolete
(
"Use a strongly-typed overload instead."
)]
public
void
Add
<
T
>(
OptionKey2
optionKey
,
T
value
)
=>
_options
.
Add
(
optionKey
,
value
);
public
void
AddRange
(
OptionsCollection
options
)
{
foreach
(
var
(
key
,
value
)
in
options
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录