Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
db428852
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,发现更多精彩内容 >>
未验证
提交
db428852
编写于
7月 17, 2019
作者:
P
Petr Houška
提交者:
GitHub
7月 17, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into SyntaxKindsService-cleanup
上级
827a7132
7e24bd67
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
168 addition
and
27 deletion
+168
-27
eng/config/PublishData.json
eng/config/PublishData.json
+6
-6
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs
.../Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs
+62
-0
src/EditorFeatures/CSharpTest/EditAndContinue/StatementEditingTests.cs
...tures/CSharpTest/EditAndContinue/StatementEditingTests.cs
+93
-7
src/EditorFeatures/CSharpTest/EditAndContinue/StatementMatchingTests.cs
...ures/CSharpTest/EditAndContinue/StatementMatchingTests.cs
+4
-4
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxKindsService.cs
...arp/Portable/LanguageServices/CSharpSyntaxKindsService.cs
+0
-6
src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs
...rtable/Indentation/AbstractIndentationService.Indenter.cs
+3
-3
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxKindsService.cs
...anguageServices/SyntaxFactsService/ISyntaxKindsService.cs
+0
-1
未找到文件。
eng/config/PublishData.json
浏览文件 @
db428852
...
...
@@ -74,23 +74,23 @@
"vsMajorVersion"
:
16
,
"ibcSourceBranch"
:
"master-vs-deps"
},
"features/
lspSupport
"
:
{
"features/
razorSupport2
"
:
{
"nugetKind"
:
[
"Shipping"
,
"NonShipping"
],
"version"
:
"3.1.*"
,
"nuget"
:
[
"https://dotnet.myget.org/F/roslyn/api/v2/package"
],
"vsix"
:
[
"https://dotnet.myget.org/F/roslyn/vsix/upload"
],
"channels"
:
[
"
lspSupport
"
],
"channels"
:
[
"
razorSupport2
"
],
"vsBranch"
:
"lab/d16.1stg"
,
"vsMajorVersion"
:
16
,
"ibcSourceBranch"
:
"master-vs-deps"
},
"features/
razorSupport2
"
:
{
"features/
compilerNext
"
:
{
"nugetKind"
:
[
"Shipping"
,
"NonShipping"
],
"version"
:
"3.
1
.*"
,
"version"
:
"3.
4
.*"
,
"nuget"
:
[
"https://dotnet.myget.org/F/roslyn/api/v2/package"
],
"vsix"
:
[
"https://dotnet.myget.org/F/roslyn/vsix/upload"
],
"channels"
:
[
"
razorSupport2
"
],
"vsBranch"
:
"
lab/d16.1stg
"
,
"channels"
:
[
"
compilerNext
"
],
"vsBranch"
:
"
master
"
,
"vsMajorVersion"
:
16
,
"ibcSourceBranch"
:
"master-vs-deps"
}
...
...
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueClosureTests.cs
浏览文件 @
db428852
...
...
@@ -3,6 +3,7 @@
using
System.Collections.Immutable
;
using
System.Linq
;
using
System.Reflection.Metadata.Ecma335
;
using
Microsoft.CodeAnalysis.CodeGen
;
using
Microsoft.CodeAnalysis.CSharp.Symbols
;
using
Microsoft.CodeAnalysis.CSharp.Test.Utilities
;
using
Microsoft.CodeAnalysis.CSharp.UnitTests
;
...
...
@@ -172,6 +173,67 @@ void F()
Row
(
5
,
TableIndex
.
CustomAttribute
,
EditAndContinueOperation
.
Default
));
}
[
Fact
]
public
void
MethodWithStaticLocalFunction_ChangeStatic
()
{
var
source0
=
MarkedSource
(
@"
using System;
class C
{
void F()
{
<N:0>int x() => 1;</N:0>
}
}"
);
var
source1
=
MarkedSource
(
@"
using System;
class C
{
void F()
{
<N:0>static int x() => 1;</N:0>
}
}"
);
var
compilation0
=
CreateCompilation
(
source0
.
Tree
,
options
:
ComSafeDebugDll
.
WithMetadataImportOptions
(
MetadataImportOptions
.
All
));
var
compilation1
=
compilation0
.
WithSource
(
source1
.
Tree
);
var
v0
=
CompileAndVerify
(
compilation0
);
var
md0
=
ModuleMetadata
.
CreateFromImage
(
v0
.
EmittedAssemblyData
);
var
reader0
=
md0
.
MetadataReader
;
var
f0
=
compilation0
.
GetMember
<
MethodSymbol
>(
"C.F"
);
var
f1
=
compilation1
.
GetMember
<
MethodSymbol
>(
"C.F"
);
var
generation0
=
EmitBaseline
.
CreateInitialBaseline
(
md0
,
v0
.
CreateSymReader
().
GetEncMethodDebugInfo
);
var
diff1
=
compilation1
.
EmitDifference
(
generation0
,
ImmutableArray
.
Create
(
new
SemanticEdit
(
SemanticEditKind
.
Update
,
f0
,
f1
,
GetSyntaxMapFromMarkers
(
source0
,
source1
),
preserveLocalVariables
:
true
)));
diff1
.
VerifySynthesizedMembers
(
"C: {<F>g__x|0_0}"
);
var
md1
=
diff1
.
GetMetadata
();
var
reader1
=
md1
.
Reader
;
// Method updates
CheckEncLogDefinitions
(
reader1
,
Row
(
1
,
TableIndex
.
MethodDef
,
EditAndContinueOperation
.
Default
),
Row
(
3
,
TableIndex
.
MethodDef
,
EditAndContinueOperation
.
Default
),
Row
(
5
,
TableIndex
.
CustomAttribute
,
EditAndContinueOperation
.
Default
));
var
testData0
=
new
CompilationTestData
();
var
bytes0
=
compilation0
.
EmitToArray
(
testData
:
testData0
);
var
localFunction0
=
testData0
.
GetMethodData
(
"C.<F>g__x|0_0"
).
Method
;
Assert
.
True
(
localFunction0
.
IsStatic
);
var
localFunction1
=
diff1
.
TestData
.
GetMethodData
(
"C.<F>g__x|0_0"
).
Method
;
Assert
.
True
(
localFunction1
.
IsStatic
);
}
[
Fact
]
public
void
MethodWithStaticLambdaGeneric1
()
{
...
...
src/EditorFeatures/CSharpTest/EditAndContinue/StatementEditingTests.cs
浏览文件 @
db428852
...
...
@@ -6816,6 +6816,92 @@ static void F()
});
}
[
Fact
]
public
void
LocalFunction_AddStatic
()
{
var
src1
=
@"class Test { void M() { int local() { throw null; } } }"
;
var
src2
=
@"class Test { void M() { static int local() { throw null; } } }"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [void M() { int local() { throw null; } }]@13 -> [void M() { static int local() { throw null; } }]@13"
);
edits
.
VerifyRudeDiagnostics
();
}
[
Fact
]
public
void
LocalFunction_RemoveStatic
()
{
var
src1
=
@"class Test { void M() { static int local() { throw null; } } }"
;
var
src2
=
@"class Test { void M() { int local() { throw null; } } }"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [void M() { static int local() { throw null; } }]@13 -> [void M() { int local() { throw null; } }]@13"
);
edits
.
VerifyRudeDiagnostics
();
}
[
Fact
]
public
void
LocalFunction_AddUnsafe
()
{
var
src1
=
@"class Test { void M() { int local() { throw null; } } }"
;
var
src2
=
@"class Test { void M() { unsafe int local() { throw null; } } }"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [void M() { int local() { throw null; } }]@13 -> [void M() { unsafe int local() { throw null; } }]@13"
);
edits
.
VerifyRudeDiagnostics
();
}
[
Fact
]
public
void
LocalFunction_RemoveUnsafe
()
{
var
src1
=
@"class Test { void M() { unsafe int local() { throw null; } } }"
;
var
src2
=
@"class Test { void M() { int local() { throw null; } } }"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [void M() { unsafe int local() { throw null; } }]@13 -> [void M() { int local() { throw null; } }]@13"
);
edits
.
VerifyRudeDiagnostics
();
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/37054"
)]
public
void
LocalFunction_AddAsync
()
{
var
src1
=
@"class Test { void M() { int local() { throw null; } } }"
;
var
src2
=
@"class Test { void M() { async int local() { throw null; } } }"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [void M() { int local() { throw null; } }]@13 -> [void M() { async int local() { throw null; } }]@13"
);
edits
.
VerifyRudeDiagnostics
(
Diagnostic
(
RudeEditKind
.
ModifiersUpdate
,
"async int local() "
,
FeaturesResources
.
method
));
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/37054"
)]
public
void
LocalFunction_RemoveAsync
()
{
var
src1
=
@"class Test { void M() { async int local() { throw null; } } }"
;
var
src2
=
@"class Test { void M() { int local() { throw null; } } }"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [void M() { async int local() { throw null; } }]@13 -> [void M() { int local() { throw null; } }]@13"
);
edits
.
VerifyRudeDiagnostics
(
Diagnostic
(
RudeEditKind
.
ModifiersUpdate
,
"int local() "
,
FeaturesResources
.
method
));
}
#
endregion
#
region
Queries
...
...
@@ -8413,7 +8499,7 @@ static async Task<int> F()
}
}
"
;
var
edits
=
GetTopEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetTopEdits
(
src1
,
src2
);
// consider: these edits can be allowed if we get more sophisticated
edits
.
VerifyRudeDiagnostics
(
...
...
@@ -8956,7 +9042,7 @@ public void VarPattern_Update()
if (o3 is (string k, int l2, int m)) return;
"
;
var
edits
=
GetMethodEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetMethodEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [if (o is (var x, var y)) return;]@4 -> [if (o is (int x, int y1)) return;]@4"
,
...
...
@@ -8984,7 +9070,7 @@ public void PositionalPattern_Update1()
};
"
;
var
edits
=
GetMethodEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetMethodEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
@"Update [r = (x, y, z) switch {
...
...
@@ -9017,7 +9103,7 @@ public void PositionalPattern_Update2()
};
"
;
var
edits
=
GetMethodEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetMethodEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
@"Update [r = (x, y, z) switch {
...
...
@@ -9054,7 +9140,7 @@ public void PositionalPattern_Reorder()
};
"
;
var
edits
=
GetMethodEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetMethodEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
@"Update [r = (x, y, z) switch {
...
...
@@ -9089,7 +9175,7 @@ public void PropertyPattern_Update()
if (o is string { Length: 7 } s7) return 5;
"
;
var
edits
=
GetMethodEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetMethodEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
"Update [if (address is { State: \"WA\" }) return 1;]@4 -> [if (address is { ZipCode: 98052 }) return 4;]@4"
,
...
...
@@ -9127,7 +9213,7 @@ public void RecursivePatterns_Reorder()
};
"
;
var
edits
=
GetMethodEdits
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
)
);
var
edits
=
GetMethodEdits
(
src1
,
src2
);
edits
.
VerifyEdits
(
@"Update [r = obj switch
...
...
src/EditorFeatures/CSharpTest/EditAndContinue/StatementMatchingTests.cs
浏览文件 @
db428852
...
...
@@ -1638,7 +1638,7 @@ public void VarPattern()
if (!(o7 is var (g, e, f))) return;
if (!(o3 is (string k, int l2, int m))) return;
"
;
var
match
=
GetMethodMatches
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
),
kind
:
MethodKind
.
Regular
);
var
match
=
GetMethodMatches
(
src1
,
src2
,
kind
:
MethodKind
.
Regular
);
var
actual
=
ToMatchingPairs
(
match
);
var
expected
=
new
MatchingPairs
{
...
...
@@ -1687,7 +1687,7 @@ public void PositionalPattern()
};
"
;
var
match
=
GetMethodMatches
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
),
kind
:
MethodKind
.
Regular
);
var
match
=
GetMethodMatches
(
src1
,
src2
,
kind
:
MethodKind
.
Regular
);
var
actual
=
ToMatchingPairs
(
match
);
var
expected
=
new
MatchingPairs
{
...
...
@@ -1719,7 +1719,7 @@ public void PropertyPattern()
if (o is string { Length: 7 } s7) return 5;
"
;
var
match
=
GetMethodMatches
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
),
kind
:
MethodKind
.
Regular
);
var
match
=
GetMethodMatches
(
src1
,
src2
,
kind
:
MethodKind
.
Regular
);
var
actual
=
ToMatchingPairs
(
match
);
var
expected
=
new
MatchingPairs
{
...
...
@@ -1764,7 +1764,7 @@ public void RecursivePatterns()
};
"
;
var
match
=
GetMethodMatches
(
src1
,
src2
,
CSharpParseOptions
.
Default
.
WithLanguageVersion
(
LanguageVersion
.
Preview
),
kind
:
MethodKind
.
Regular
);
var
match
=
GetMethodMatches
(
src1
,
src2
,
kind
:
MethodKind
.
Regular
);
var
actual
=
ToMatchingPairs
(
match
);
var
expected
=
new
MatchingPairs
{
...
...
src/Workspaces/CSharp/Portable/LanguageServices/CSharpSyntaxKindsService.cs
浏览文件 @
db428852
...
...
@@ -22,17 +22,11 @@ private CSharpSyntaxKindsService()
public
override
int
LogicalOrExpression
=>
(
int
)
SyntaxKind
.
LogicalOrExpression
;
public
override
int
EndOfFileToken
=>
(
int
)
SyntaxKind
.
EndOfFileToken
;
public
override
int
AwaitKeyword
=>
(
int
)
SyntaxKind
.
AwaitKeyword
;
public
override
int
IdentifierToken
=>
(
int
)
SyntaxKind
.
IdentifierToken
;
public
override
int
GlobalKeyword
=>
(
int
)
SyntaxKind
.
GlobalKeyword
;
public
override
int
IncompleteMember
=>
(
int
)
SyntaxKind
.
IncompleteMember
;
public
override
int
UsingStatement
=>
(
int
)
SyntaxKind
.
UsingStatement
;
public
override
int
ReturnStatement
=>
(
int
)
SyntaxKind
.
ReturnStatement
;
public
override
int
HashToken
=>
(
int
)
SyntaxKind
.
HashToken
;
}
}
src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.
Abstract
Indenter.cs
→
src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs
浏览文件 @
db428852
...
...
@@ -35,7 +35,7 @@ protected struct Indenter
(
tk
.
LeadingTrivia
.
Any
(
tr
=>
tr
.
IsDirective
)
||
tk
.
TrailingTrivia
.
Any
(
tr
=>
tr
.
IsDirective
));
private
readonly
ISyntaxFactsService
_syntaxFacts
;
private
readonly
int
T
abSize
;
private
readonly
int
_t
abSize
;
public
Indenter
(
AbstractIndentationService
<
TSyntaxRoot
>
service
,
...
...
@@ -52,13 +52,13 @@ protected struct Indenter
this
.
OptionSet
=
optionSet
;
this
.
Root
=
(
TSyntaxRoot
)
document
.
Root
;
this
.
LineToBeIndented
=
lineToBeIndented
;
this
.
T
abSize
=
this
.
OptionSet
.
GetOption
(
FormattingOptions
.
TabSize
,
Root
.
Language
);
this
.
_t
abSize
=
this
.
OptionSet
.
GetOption
(
FormattingOptions
.
TabSize
,
Root
.
Language
);
this
.
CancellationToken
=
cancellationToken
;
this
.
Rules
=
rules
;
this
.
Finder
=
new
BottomUpBaseIndentationFinder
(
new
ChainedFormattingRules
(
this
.
Rules
,
OptionSet
),
this
.
T
abSize
,
this
.
_t
abSize
,
this
.
OptionSet
.
GetOption
(
FormattingOptions
.
IndentationSize
,
Root
.
Language
),
tokenStream
:
null
);
}
...
...
src/Workspaces/Core/Portable/LanguageServices/SyntaxFactsService/ISyntaxKindsService.cs
浏览文件 @
db428852
...
...
@@ -44,7 +44,6 @@ internal abstract class AbstractSyntaxKindsService : ISyntaxKindsService
public
abstract
int
LogicalAndExpression
{
get
;
}
public
abstract
int
LogicalOrExpression
{
get
;
}
public
abstract
int
EndOfFileToken
{
get
;
}
public
abstract
int
IdentifierToken
{
get
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录