Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
b4fa09a4
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,发现更多精彩内容 >>
提交
b4fa09a4
编写于
8月 10, 2016
作者:
C
Charles Stoner
提交者:
GitHub
8月 10, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13072 from cston/ref-errors
Remove unused ref return error codes
上级
6a175eb9
0cf055fb
变更
8
展开全部
显示空白变更内容
内联
并排
Showing
8 changed file
with
263 addition
and
307 deletion
+263
-307
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
+0
-18
src/Compilers/CSharp/Portable/CSharpResources.resx
src/Compilers/CSharp/Portable/CSharpResources.resx
+0
-6
src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
+25
-34
src/Compilers/CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs
...CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs
+135
-142
src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
+8
-8
src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs
src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs
+2
-2
src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs
src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs
+2
-2
src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturns.cs
...ers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturns.cs
+91
-95
未找到文件。
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
浏览文件 @
b4fa09a4
...
...
@@ -6118,24 +6118,6 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to '{0}' cannot be assigned a reference because it is not a by-reference local.
/// </summary>
internal static string ERR_MustBeRefAssignable {
get {
return ResourceManager.GetString("ERR_MustBeRefAssignable", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Expected a by-reference local.
/// </summary>
internal static string ERR_MustBeRefAssignableLocal {
get {
return ResourceManager.GetString("ERR_MustBeRefAssignableLocal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to In order for '{0}' to be applicable as a short circuit operator, its declaring type '{1}' must define operator true and operator false.
/// </summary>
...
...
src/Compilers/CSharp/Portable/CSharpResources.resx
浏览文件 @
b4fa09a4
...
...
@@ -4804,12 +4804,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data
name=
"ERR_RefReturnStructThis"
xml:space=
"preserve"
>
<value>
Struct members cannot return 'this' or other instance members by reference
</value>
</data>
<data
name=
"ERR_MustBeRefAssignable"
xml:space=
"preserve"
>
<value>
'{0}' cannot be assigned a reference because it is not a by-reference local
</value>
</data>
<data
name=
"ERR_MustBeRefAssignableLocal"
xml:space=
"preserve"
>
<value>
Expected a by-reference local
</value>
</data>
<data
name=
"ERR_InitializeByValueVariableWithReference"
xml:space=
"preserve"
>
<value>
Cannot initialize a by-value variable with a reference
</value>
</data>
...
...
src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
浏览文件 @
b4fa09a4
...
...
@@ -1390,44 +1390,35 @@ internal enum ErrorCode
ERR_MustHaveRefReturn
=
8150
,
ERR_RefReturnMustHaveIdentityConversion
=
8151
,
ERR_CloseUnimplementedInterfaceMemberWrongRefReturn
=
8152
,
ERR_
VoidReturningMethodCannotReturnByRef
=
8153
,
ERR_
RefReturningCallInExpressionTree
=
8153
,
ERR_BadIteratorReturnRef
=
8154
,
ERR_BadRefReturnExpressionTree
=
8155
,
ERR_RefReturningCallInExpressionTree
=
8156
,
ERR_RefReturnLvalueExpected
=
8157
,
ERR_RefReturnNonreturnableLocal
=
8158
,
ERR_RefReturnNonreturnableLocal2
=
8159
,
ERR_RefReturnRangeVariable
=
8160
,
ERR_RefReturnRangeVariable2
=
8170
,
ERR_RefReturnReadonly
=
8171
,
ERR_RefReturnReadonlyStatic
=
8172
,
ERR_RefReturnReadonly2
=
8173
,
ERR_RefReturnReadonlyStatic2
=
8174
,
ERR_RefReturnCall
=
8175
,
ERR_RefReturnCall2
=
8176
,
ERR_RefReturnParameter
=
8177
,
ERR_RefReturnParameter2
=
8178
,
ERR_RefReturnLocal
=
8179
,
ERR_RefReturnLocal2
=
8180
,
ERR_RefReturnStructThis
=
8181
,
// Available = 8182, 8183
ERR_MustBeRefAssignable
=
8184
,
ERR_MustBeRefAssignableLocal
=
8185
,
ERR_InitializeByValueVariableWithReference
=
8186
,
ERR_InitializeByReferenceVariableWithValue
=
8187
,
ERR_RefAssignmentMustHaveIdentityConversion
=
8188
,
ERR_ByReferenceVariableMustBeInitialized
=
8189
,
ERR_AnonDelegateCantUseLocal
=
8190
,
ERR_BadIteratorLocalType
=
8191
,
ERR_BadAsyncLocalType
=
8192
,
ERR_RefReturningCallAndAwait
=
8193
,
ERR_RefReturnLvalueExpected
=
8156
,
ERR_RefReturnNonreturnableLocal
=
8157
,
ERR_RefReturnNonreturnableLocal2
=
8158
,
ERR_RefReturnRangeVariable
=
8159
,
ERR_RefReturnReadonly
=
8160
,
ERR_RefReturnReadonlyStatic
=
8161
,
ERR_RefReturnReadonly2
=
8162
,
ERR_RefReturnReadonlyStatic2
=
8163
,
ERR_RefReturnCall
=
8164
,
ERR_RefReturnCall2
=
8165
,
ERR_RefReturnParameter
=
8166
,
ERR_RefReturnParameter2
=
8167
,
ERR_RefReturnLocal
=
8168
,
ERR_RefReturnLocal2
=
8169
,
ERR_RefReturnStructThis
=
8170
,
ERR_InitializeByValueVariableWithReference
=
8171
,
ERR_InitializeByReferenceVariableWithValue
=
8172
,
ERR_RefAssignmentMustHaveIdentityConversion
=
8173
,
ERR_ByReferenceVariableMustBeInitialized
=
8174
,
ERR_AnonDelegateCantUseLocal
=
8175
,
ERR_BadIteratorLocalType
=
8176
,
ERR_BadAsyncLocalType
=
8177
,
ERR_RefReturningCallAndAwait
=
8178
,
#
endregion
diagnostics
for
ref
locals
and
ref
returns
introduced
in
C
#
7
// Available = 81
94,
8195
// Available = 81
79-
8195
#
region
diagnostics
for
out
var
ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList
=
8196
,
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/InheritanceBindingTests.cs
浏览文件 @
b4fa09a4
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs
浏览文件 @
b4fa09a4
...
...
@@ -1193,13 +1193,13 @@ static void M()
"
;
CreateCompilationWithMscorlib45
(
text
).
VerifyDiagnostics
(
// (11,22): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (11,22): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// ME(() => ref i);
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"i"
).
WithLocation
(
11
,
22
),
// (12,20): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (12,20): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// ME(() => { return ref i; });
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"return"
).
WithLocation
(
12
,
20
),
// (13,23): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (13,23): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// ME(delegate { return ref i; });
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"return"
).
WithLocation
(
13
,
23
));
}
...
...
@@ -1223,13 +1223,13 @@ static void M()
"
;
CreateCompilationWithMscorlib45
(
text
).
VerifyDiagnostics
(
// (9,33): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (9,33): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// var e = new E(() => ref i);
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"i"
).
WithLocation
(
9
,
33
),
// (10,27): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (10,27): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// e = new E(() => { return ref i; });
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"return"
).
WithLocation
(
10
,
27
),
// (11,30): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (11,30): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// e = new E(delegate { return ref i; });
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"return"
).
WithLocation
(
11
,
30
));
}
...
...
@@ -1268,10 +1268,10 @@ static void M()
"
;
CreateCompilationWithMscorlib45
(
text
).
VerifyDiagnostics
(
// (18,13): error CS8
084
: By-value returns may only be used in by-value returning methods.
// (18,13): error CS8
150
: By-value returns may only be used in by-value returning methods.
// return i;
Diagnostic
(
ErrorCode
.
ERR_MustHaveRefReturn
,
"return"
).
WithLocation
(
18
,
13
),
// (23,17): error CS8
083
: By-reference returns may only be used in by-reference returning methods.
// (23,17): error CS8
149
: By-reference returns may only be used in by-reference returning methods.
// return ref i;
Diagnostic
(
ErrorCode
.
ERR_MustNotHaveRefReturn
,
"return"
).
WithLocation
(
23
,
17
));
}
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs
浏览文件 @
b4fa09a4
...
...
@@ -293,7 +293,7 @@ class Test<T>
// (28,20): error CS0103: The name 'List2' does not exist in the current context
// s = nameof(List2<>.Add);
Diagnostic
(
ErrorCode
.
ERR_NameNotInContext
,
"List2<>"
).
WithArguments
(
"List2"
).
WithLocation
(
28
,
20
),
// (31,20): error CS8
083
: An alias-qualified name is not an expression.
// (31,20): error CS8
149
: An alias-qualified name is not an expression.
// s = nameof(global::Program); // not an expression
Diagnostic
(
ErrorCode
.
ERR_AliasQualifiedNameNotAnExpression
,
"global::Program"
).
WithLocation
(
31
,
20
),
// (32,20): error CS0305: Using the generic type 'Test<T>' requires 1 type arguments
...
...
@@ -305,7 +305,7 @@ class Test<T>
// (33,20): error CS0841: Cannot use local variable 'b' before it is declared
// s = nameof(b); // cannot use before declaration
Diagnostic
(
ErrorCode
.
ERR_VariableUsedBeforeDeclaration
,
"b"
).
WithArguments
(
"b"
).
WithLocation
(
33
,
20
),
// (35,20): error CS8
084
: Type parameters are not allowed on a method group as an argument to 'nameof'.
// (35,20): error CS8
150
: Type parameters are not allowed on a method group as an argument to 'nameof'.
// s = nameof(System.Linq.Enumerable.Select<int, int>); // type parameters not allowed on method group in nameof
Diagnostic
(
ErrorCode
.
ERR_NameofMethodGroupWithTypeParameters
,
"System.Linq.Enumerable.Select<int, int>"
).
WithLocation
(
35
,
20
),
// (43,13): error CS0103: The name 'nameof' does not exist in the current context
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/OutVarTests.cs
浏览文件 @
b4fa09a4
...
...
@@ -11822,7 +11822,7 @@ static object Test1(out int x, out int x2)
parseOptions
:
TestOptions
.
Regular
);
compilation
.
VerifyDiagnostics
(
// (7,23): error CS8
927
: Reference to an implicitly-typed out variable 'x1' is not permitted in the same argument list.
// (7,23): error CS8
181
: Reference to an implicitly-typed out variable 'x1' is not permitted in the same argument list.
// out x1);
Diagnostic
(
ErrorCode
.
ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList
,
"x1"
).
WithArguments
(
"x1"
).
WithLocation
(
7
,
23
)
);
...
...
@@ -11863,7 +11863,7 @@ static object Test1(out int x, int x2)
parseOptions
:
TestOptions
.
Regular
);
compilation
.
VerifyDiagnostics
(
// (7,25): error CS8
927
: Reference to an implicitly-typed out variable 'x1' is not permitted in the same argument list.
// (7,25): error CS8
181
: Reference to an implicitly-typed out variable 'x1' is not permitted in the same argument list.
// Test1(out x1,
Diagnostic
(
ErrorCode
.
ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList
,
"x1"
).
WithArguments
(
"x1"
).
WithLocation
(
7
,
25
)
);
...
...
src/Compilers/CSharp/Test/Semantic/Semantics/RefLocalsAndReturns.cs
浏览文件 @
b4fa09a4
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录