Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
d3f19548
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,发现更多精彩内容 >>
提交
d3f19548
编写于
3月 16, 2015
作者:
T
Tomas Matousek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Report an error if the type of an expression of a query clause changes
上级
75e83b68
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
90 addition
and
2 deletion
+90
-2
src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs
...ures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs
+34
-0
src/EditorFeatures/VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb
...VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb
+27
-0
src/Features/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs
...s/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs
+5
-0
src/Features/Core/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
...s/Core/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
+6
-0
src/Features/Core/EditAndContinue/RudeEditDiagnosticDescriptors.cs
...res/Core/EditAndContinue/RudeEditDiagnosticDescriptors.cs
+1
-0
src/Features/Core/EditAndContinue/RudeEditKind.cs
src/Features/Core/EditAndContinue/RudeEditKind.cs
+1
-2
src/Features/Core/FeaturesResources.Designer.cs
src/Features/Core/FeaturesResources.Designer.cs
+9
-0
src/Features/Core/FeaturesResources.resx
src/Features/Core/FeaturesResources.resx
+3
-0
src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb
...sic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb
+4
-0
未找到文件。
src/EditorFeatures/CSharpTest/EditAndContinue/RudeEditStatementTests.cs
浏览文件 @
d3f19548
...
...
@@ -4326,6 +4326,40 @@ void F()
#
region
Queries
[
Fact
]
public
void
Queries_Update_Signature1
()
{
var
src1
=
@"
using System;
using System.Linq;
class C
{
void F()
{
var result = from a in new[] {1} from b in new[] {2} select b;
}
}
"
;
var
src2
=
@"
using System;
using System.Linq;
class C
{
void F()
{
var result = from a in new[] {1.0} from b in new[] {2} select b;
}
}
"
;
var
edits
=
GetTopEdits
(
src1
,
src2
);
edits
.
VerifySemanticDiagnostics
(
Diagnostic
(
RudeEditKind
.
ChangingQueryLambdaType
,
"from"
,
"from clause"
),
Diagnostic
(
RudeEditKind
.
ChangingQueryLambdaType
,
"select"
,
"select clause"
));
}
[
Fact
]
public
void
Queries_FromSelect_Update1
()
{
...
...
src/EditorFeatures/VisualBasicTest/EditAndContinue/RudeEditStatementTests.vb
浏览文件 @
d3f19548
...
...
@@ -3862,6 +3862,33 @@ End Class
#End Region
#Region "Queries"
<
Fact
(
Skip
:
=
"https://github.com/dotnet/roslyn/issues/1315"
),
WorkItem
(
1315
)
>
Public
Sub
Queries_Update_Signature1
()
Dim
src1
=
"
Imports System
Imports System.Linq
Class C
Sub F()
Dim result = From a In {1} From b In {2} Select b
End Sub
End Class
"
Dim
src2
=
"
Imports System
Imports System.Linq
Class C
Sub F()
Dim result = From a In {1.0} From b In {2} Select b
End Sub
End Class
"
Dim
edits
=
GetTopEdits
(
src1
,
src2
)
edits
.
VerifySemanticDiagnostics
(
Diagnostic
(
RudeEditKind
.
ChangingQueryLambdaType
,
"From"
,
"From clause"
),
Diagnostic
(
RudeEditKind
.
ChangingQueryLambdaType
,
"Select"
,
"Select clause"
))
End
Sub
<
Fact
>
Public
Sub
Queries_FromSelect_Update
()
...
...
src/Features/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs
浏览文件 @
d3f19548
...
...
@@ -887,6 +887,11 @@ internal override bool IsLambda(SyntaxNode node)
return
LambdaUtilities
.
IsLambda
(
node
);
}
internal
override
bool
IsLambdaExpression
(
SyntaxNode
node
)
{
return
node
is
LambdaExpressionSyntax
;
}
internal
override
bool
TryGetLambdaBodies
(
SyntaxNode
node
,
out
SyntaxNode
body1
,
out
SyntaxNode
body2
)
{
return
LambdaUtilities
.
TryGetLambdaBodies
(
node
,
out
body1
,
out
body2
);
...
...
src/Features/Core/EditAndContinue/AbstractEditAndContinueAnalyzer.cs
浏览文件 @
d3f19548
...
...
@@ -233,6 +233,7 @@ private SyntaxNode FindStatement(SyntaxNode declarationBody, int position, out i
internal
abstract
bool
IsMethod
(
SyntaxNode
declaration
);
internal
abstract
bool
IsLambda
(
SyntaxNode
node
);
internal
abstract
bool
IsLambdaExpression
(
SyntaxNode
node
);
internal
abstract
bool
IsClosureScope
(
SyntaxNode
node
);
internal
abstract
bool
ContainsLambda
(
SyntaxNode
declaration
);
internal
abstract
SyntaxNode
GetLambda
(
SyntaxNode
lambdaBody
);
...
...
@@ -3195,6 +3196,11 @@ private void ReportLambdaSignatureRudeEdits(SemanticModel oldModel, SyntaxNode o
var
newLambda
=
GetLambda
(
newLambdaBody
);
if
(!
IsLambdaExpression
(
newLambda
))
{
rudeEdit
=
RudeEditKind
.
ChangingQueryLambdaType
;
}
diagnostics
.
Add
(
new
RudeEditDiagnostic
(
rudeEdit
,
GetDiagnosticSpan
(
newLambda
,
EditKind
.
Update
),
...
...
src/Features/Core/EditAndContinue/RudeEditDiagnosticDescriptors.cs
浏览文件 @
d3f19548
...
...
@@ -66,6 +66,7 @@ internal static class RudeEditDiagnosticDescriptors
{
GetDescriptorPair
(
RudeEditKind
.
ChangingCapturedVariableScope
,
FeaturesResources
.
ChangingCapturedVariableScope
)
},
{
GetDescriptorPair
(
RudeEditKind
.
ChangingLambdaParameters
,
FeaturesResources
.
ChangingLambdaParameters
)
},
{
GetDescriptorPair
(
RudeEditKind
.
ChangingLambdaReturnType
,
FeaturesResources
.
ChangingLambdaReturnType
)
},
{
GetDescriptorPair
(
RudeEditKind
.
ChangingQueryLambdaType
,
FeaturesResources
.
ChangingQueryLambdaType
)
},
{
GetDescriptorPair
(
RudeEditKind
.
AccessingCapturedVariableInLambda
,
FeaturesResources
.
AccessingCapturedVariableInLambda
)
},
{
GetDescriptorPair
(
RudeEditKind
.
NotAccessingCapturedVariableInLambda
,
FeaturesResources
.
NotAccessingCapturedVariableInLambda
)
},
{
GetDescriptorPair
(
RudeEditKind
.
InsertLambdaWithMultiScopeCapture
,
FeaturesResources
.
InsertLambdaWithMultiScopeCapture
)
},
...
...
src/Features/Core/EditAndContinue/RudeEditKind.cs
浏览文件 @
d3f19548
...
...
@@ -71,8 +71,7 @@ internal enum RudeEditKind : ushort
NotAccessingCapturedVariableInLambda
=
56
,
InsertLambdaWithMultiScopeCapture
=
57
,
DeleteLambdaWithMultiScopeCapture
=
58
,
// 59 can be used
ChangingQueryLambdaType
=
59
,
InsertAroundActiveStatement
=
60
,
DeleteAroundActiveStatement
=
61
,
...
...
src/Features/Core/FeaturesResources.Designer.cs
浏览文件 @
d3f19548
...
...
@@ -420,6 +420,15 @@ internal class FeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Changing the type of '{0}' will prevent the debug session from continuing..
/// </summary>
internal
static
string
ChangingQueryLambdaType
{
get
{
return
ResourceManager
.
GetString
(
"ChangingQueryLambdaType"
,
resourceCulture
);
}
}
/// <summary>
/// Looks up a localized string similar to Changing the constraint from '{0}' to '{1}' will prevent the debug session from continuing..
/// </summary>
...
...
src/Features/Core/FeaturesResources.resx
浏览文件 @
d3f19548
...
...
@@ -396,6 +396,9 @@
<data
name=
"ChangingLambdaReturnType"
xml:space=
"preserve"
>
<value>
Changing the return type of '{0}' will prevent the debug session from continuing.
</value>
</data>
<data
name=
"ChangingQueryLambdaType"
xml:space=
"preserve"
>
<value>
Changing the type of '{0}' will prevent the debug session from continuing.
</value>
</data>
<data
name=
"ChangingCapturedVariableScope"
xml:space=
"preserve"
>
<value>
Changing the declaration scope of a captured variable '{0}' will prevent the debug session from continuing.
</value>
</data>
...
...
src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb
浏览文件 @
d3f19548
...
...
@@ -937,6 +937,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
Return
LambdaUtilities
.
IsLambda
(
node
)
End
Function
Friend
Overrides
Function
IsLambdaExpression
(
node
As
SyntaxNode
)
As
Boolean
Return
TypeOf
node
Is
LambdaExpressionSyntax
End
Function
Friend
Overrides
Function
TryGetLambdaBodies
(
node
As
SyntaxNode
,
ByRef
body1
As
SyntaxNode
,
ByRef
body2
As
SyntaxNode
)
As
Boolean
Return
LambdaUtilities
.
TryGetLambdaBodies
(
node
,
body1
,
body2
)
End
Function
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录