Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b0615aef
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,发现更多精彩内容 >>
提交
b0615aef
编写于
10月 24, 2019
作者:
G
Gen Lu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix test failures
上级
3c3a8a1f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
282 addition
and
191 deletion
+282
-191
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs
...Providers/ExtensionMethodImportCompletionProviderTests.cs
+275
-188
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.vb
...Providers/ExtensionMethodImportCompletionProviderTests.vb
+2
-2
src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex_Create.cs
...Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex_Create.cs
+5
-1
未找到文件。
src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs
浏览文件 @
b0615aef
...
...
@@ -205,31 +205,31 @@ public void M(int x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UsingAliasInDeclaration_PrimitiveType
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
using MyInt = System.Int32;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this MyInt x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(int x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -243,31 +243,31 @@ public void M(int x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UsingAliasInDeclaration_RegularType
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
using MyAlias = System.Exception;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this MyAlias x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(Exception x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -281,31 +281,31 @@ public void M(Exception x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UsingAliasInDeclaration_GenericType
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
using MyAlias = System.Collections.Generic.List<int>;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this MyAlias x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(System.Collections.Generic.List<int> x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -319,30 +319,30 @@ public void M(System.Collections.Generic.List<int> x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UsingAliasInDeclaration_RegularTypeWithSameSimpleName
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using DataTime = System.Exception;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this System.DateTime x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(DateTime x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -356,31 +356,31 @@ public void M(DateTime x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UsingAliasInDeclaration_Namespace
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
using GenericCollection = System.Collections.Generic;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod<T>(this GenericCollection.List<T> x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(System.Collections.Generic.List<int> x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -395,31 +395,31 @@ public void M(System.Collections.Generic.List<int> x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UsingAliasInUsage
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
using MyInt = System.Int32;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(MyInt x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -446,19 +446,19 @@ public static bool ExtentionMethod(this MyType t)
=>
true
;
}}
}}
"
;
var
file2
=
$
@"
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(MyType x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
markup
,
...
...
@@ -484,19 +484,19 @@ public static bool ExtentionMethod(this object t)
=>
true
;
}}
}}
"
;
var
file2
=
$
@"
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(MyType x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
markup
,
...
...
@@ -571,19 +571,19 @@ public static bool ExtentionMethod(this MyBase t)
=>
true
;
}}
}}
"
;
var
file2
=
$
@"
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(MyType x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
markup
,
...
...
@@ -604,18 +604,18 @@ public void M(MyType x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
BoundedGenericType
(
string
type
,
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
using System.Collections.Generic;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this IEnumerable<string> t)
=> true;
}
}
}
}
"
;
}
}"
;
var
file2
=
$@"
using System;
using System.Collections.Generic;
...
...
@@ -650,17 +650,17 @@ public void M({type} x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
MatchingTypeParameter
(
string
type
,
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod<T>(this T t)
=> true;
}
}
}
}
"
;
}
}"
;
var
file2
=
$@"
using System;
using System.Collections.Generic;
...
...
@@ -691,30 +691,30 @@ public void M({type} x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TestInternalExtensionMethods_NoIVT_InReference
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
namespace Foo
{
{
{
internal static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(int x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemIsAbsentAsync
(
...
...
@@ -728,39 +728,39 @@ public void M(int x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TestConflictingInternalExtensionMethods_NoIVT_InReference
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
namespace Foo
{
{
{
internal static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Foo
{
{
{
internal static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
}
}
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(int x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -773,30 +773,30 @@ public void M(int x)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TestInternalExtensionMethods_NoIVT_InSameProject
()
{
var
file1
=
$
@"
var
file1
=
@"
using System;
namespace Foo
{
{
{
internal static class ExtensionClass
{
{
{
internal static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(int x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
ReferenceType
.
None
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -812,28 +812,28 @@ public void M(int x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TestInternalExtensionMethods_WithIVT
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(""Project1"")]
namespace Foo
{
{
{
internal static class ExtensionClass
{
{
{
internal static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(int x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -847,34 +847,34 @@ public void M(int x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
UserDefinedGenericType
(
ReferenceType
refType
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
public class MyGeneric<T>
{
{
}
}
{
}
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this MyGeneric<int> x)
=> true;
}
}
}
}
"
;
var
file2
=
$
@"
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(MyGeneric<int> x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
refType
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -889,17 +889,17 @@ public void M(MyGeneric<int> x)
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
MethodSymbolReceiver
(
string
expression
)
{
var
file1
=
$
@"
var
file1
=
@"
using System;
namespace Foo
{
{
{
public static class ExtensionClass
{
{
{
public static bool ExtentionMethod(this int x)
=> true;
}
}
}
}
"
;
}
}"
;
var
file2
=
$@"
using System;
...
...
@@ -992,7 +992,7 @@ public void M({csType} x)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
ExtensionMethodDelcaredInRootNamespaceVBSource
()
{
var
file1
=
$
@"
var
file1
=
@"
Imports System
Imports System.Runtime.CompilerServices
...
...
@@ -1002,19 +1002,19 @@ Imports System.Runtime.CompilerServices
Return True
End Function
End Module"
;
var
file2
=
$
@"
var
file2
=
@"
using System;
namespace Baz
{
{
{
public class Bat
{
{
{
public void M(int x)
{
{
{
x.$$
}
}
}
}
}
}
"
;
}
}
}"
;
var
markup
=
CreateMarkupForProjecWithVBProjectReference
(
file2
,
file1
,
sourceLanguage
:
LanguageNames
.
CSharp
,
rootNamespace
:
"Root"
);
await
VerifyTypeImportItemExistsAsync
(
...
...
@@ -1027,7 +1027,7 @@ public void M(int x)
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
ExtensionMethodDelcaredInGlobalNamespaceVBSource
()
{
var
file1
=
$
@"
var
file1
=
@"
Imports System
Imports System.Runtime.CompilerServices
...
...
@@ -1037,6 +1037,92 @@ Imports System.Runtime.CompilerServices
Return True
End Function
End Module"
;
var
file2
=
@"
using System;
namespace Baz
{
public class Bat
{
public void M(int x)
{
x.$$
}
}
}"
;
var
markup
=
CreateMarkupForProjecWithVBProjectReference
(
file2
,
file1
,
sourceLanguage
:
LanguageNames
.
CSharp
);
await
VerifyTypeImportItemIsAbsentAsync
(
markup
,
"ExtentionMethod"
,
inlineDescription
:
""
);
}
[
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TestTriggerLocation
()
{
var
file1
=
@"
using System;
namespace Foo
{
internal static class ExtensionClass
{
internal static bool ExtentionMethod(this int x)
=> true;
}
}"
;
var
file2
=
@"
using System;
namespace Baz
{
public class Bat
{
public void M(int x)
{
x.$$
var z = 10;
}
}
}"
;
var
markup
=
GetMarkup
(
file2
,
file1
,
ReferenceType
.
None
);
await
VerifyTypeImportItemExistsAsync
(
markup
,
"ExtentionMethod"
,
glyph
:
(
int
)
Glyph
.
ExtensionMethodInternal
,
// This is based on declared accessibility
inlineDescription
:
"Foo"
);
}
[
InlineData
(
"int"
,
"Int32Method"
,
"Foo"
)]
[
InlineData
(
"string"
,
"StringMethod"
,
"Bar"
,
Skip
=
"Currently can't handle aliases with idencical name"
)]
[
Theory
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)]
public
async
Task
TestIdenticalAlias_UseOuterOne
(
string
type
,
string
expectedMethodname
,
string
expectedNamespace
)
{
var
file1
=
@"
using X = System.String;
namespace Foo
{
using X = System.Int32;
internal static class ExtensionClass
{
internal static bool Int32Method(this X x)
=> true;
}
}
namespace Bar
{
internal static class ExtensionClass
{
internal static bool StringMethod(this X x)
=> true;
}
}
"
;
var
file2
=
$@"
using System;
...
...
@@ -1044,18 +1130,19 @@ namespace Baz
{{
public
class
Bat
{{
public
void
M
(
int
x
)
public
void
M
(
{
type
}
x
)
{{
x
.
$$
}}
}}
}}
"
;
var
markup
=
CreateMarkupForProjecWithVBProjectReference
(
file2
,
file1
,
sourceLanguage
:
LanguageNames
.
CSharp
);
await
VerifyTypeImportItemIsAbsentAsync
(
var
markup
=
GetMarkup
(
file2
,
file1
,
ReferenceType
.
None
);
await
VerifyTypeImportItemExistsAsync
(
markup
,
"ExtentionMethod"
,
inlineDescription
:
""
);
expectedMethodname
,
glyph
:
(
int
)
Glyph
.
ExtensionMethodInternal
,
inlineDescription
:
expectedNamespace
);
}
private
Task
VerifyTypeImportItemExistsAsync
(
string
markup
,
string
expectedItem
,
int
glyph
,
string
inlineDescription
,
string
displayTextSuffix
=
null
,
string
expectedDescriptionOrNull
=
null
)
...
...
src/EditorFeatures/VisualBasicTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.vb
浏览文件 @
b0615aef
...
...
@@ -38,7 +38,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.Completion.Complet
End
Function
<
Fact
,
Trait
(
Traits
.
Feature
,
Traits
.
Features
.
Completion
)
>
Public
Async
Function
Test
()
As
Task
Public
Async
Function
Test
ExtensionAttribute
()
As
Task
' attribute suffix isn't capitalized
Dim
file1
=
<
Text
><
!
[
CDATA
[
...
...
@@ -92,7 +92,7 @@ End Class]]></Text>.Value
Await
VerifyItemExistsAsync
(
markup
,
"ExtensionMethod3"
,
glyph
:
=
Glyph
.
ExtensionMethodPublic
,
inlineDescription
:
=
"Foo"
)
Await
VerifyItemExistsAsync
(
markup
,
"ExtensionMethod4"
,
glyph
:
=
Glyph
.
ExtensionMethodPublic
,
inlineDescription
:
=
"Foo"
)
Await
VerifyItemExistsAsync
(
markup
,
"ExtensionMethod5"
,
glyph
:
=
Glyph
.
ExtensionMethodPublic
,
inlineDescription
:
=
"Foo"
)
Await
VerifyItem
ExistsAsync
(
markup
,
"ExtensionMethod6"
,
glyph
:
=
Glyph
.
ExtensionMethodPublic
,
inlineDescription
:
=
"Foo"
)
Await
VerifyItem
IsAbsentAsync
(
markup
,
"ExtensionMethod6"
,
inlineDescription
:
=
"Foo"
)
End
Function
End
Class
End
Namespace
src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex_Create.cs
浏览文件 @
b0615aef
...
...
@@ -120,7 +120,11 @@ internal sealed partial class SyntaxTreeIndex
{
foreach
(
var
(
aliasName
,
name
)
in
aliases
)
{
Debug
.
Assert
(!
usingAliases
.
ContainsKey
(
aliasName
));
// TODO:
// we currently don't handle using aliases with same name declared
// in different containers in the document (only allowed in C#)
// e.g. see test CSharpReferenceHighlightingTests.TestAlias4
// Debug.Assert(!usingAliases.ContainsKey(aliasName));
usingAliases
[
aliasName
]
=
name
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录