Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
91fa14da
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,体验更适合开发者的 AI 搜索 >>
提交
91fa14da
编写于
1月 19, 2018
作者:
V
vsadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Constrains availability of ref conditional expressions to language versions 7.2 and higher
Fixes:#24306
上级
ea75a538
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
114 addition
and
0 deletion
+114
-0
src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
+4
-0
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
+9
-0
src/Compilers/CSharp/Portable/CSharpResources.resx
src/Compilers/CSharp/Portable/CSharpResources.resx
+3
-0
src/Compilers/CSharp/Portable/Errors/MessageID.cs
src/Compilers/CSharp/Portable/Errors/MessageID.cs
+2
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
...Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
+5
-0
src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
...Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
+5
-0
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
...p/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
+31
-0
未找到文件。
src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
浏览文件 @
91fa14da
...
...
@@ -3521,6 +3521,10 @@ private BoundExpression BindConditionalOperator(ConditionalExpressionSyntax node
diagnostics
.
Add
(
ErrorCode
.
ERR_RefConditionalNeedsTwoRefs
,
whenTrue
.
GetFirstToken
().
GetLocation
());
}
}
else
{
CheckFeatureAvailability
(
node
,
MessageID
.
IDS_FeatureRefConditional
,
diagnostics
);
}
BoundExpression
condition
=
BindBooleanExpression
(
node
.
Condition
,
diagnostics
);
...
...
src/Compilers/CSharp/Portable/CSharpResources.Designer.cs
浏览文件 @
91fa14da
...
...
@@ -10700,6 +10700,15 @@ internal class CSharpResources {
}
}
/// <summary>
/// Looks up a localized string similar to ref conditional expression.
/// </summary>
internal static string IDS_FeatureRefConditional {
get {
return ResourceManager.GetString("IDS_FeatureRefConditional", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ref extension methods.
/// </summary>
...
...
src/Compilers/CSharp/Portable/CSharpResources.resx
浏览文件 @
91fa14da
...
...
@@ -4264,6 +4264,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data
name=
"IDS_FeatureRefStructs"
xml:space=
"preserve"
>
<value>
ref structs
</value>
</data>
<data
name=
"IDS_FeatureRefConditional"
xml:space=
"preserve"
>
<value>
ref conditional expression
</value>
</data>
<data
name=
"CompilationC"
xml:space=
"preserve"
>
<value>
Compilation (C#):
</value>
</data>
...
...
src/Compilers/CSharp/Portable/Errors/MessageID.cs
浏览文件 @
91fa14da
...
...
@@ -145,6 +145,7 @@ internal enum MessageID
IDS_FeatureRefExtensionMethods
=
MessageBase
+
12728
,
IDS_StackAllocExpression
=
MessageBase
+
12729
,
IDS_FeaturePrivateProtected
=
MessageBase
+
12730
,
IDS_FeatureRefConditional
=
MessageBase
+
12731
,
}
// Message IDs may refer to strings that need to be localized.
...
...
@@ -192,6 +193,7 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
case
MessageID
.
IDS_FeatureRefStructs
:
case
MessageID
.
IDS_FeatureReadOnlyStructs
:
case
MessageID
.
IDS_FeatureRefExtensionMethods
:
case
MessageID
.
IDS_FeatureRefConditional
:
return
LanguageVersion
.
CSharp7_2
;
// C# 7.1 features.
...
...
src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Pokud chcete odstranit toto varování, můžete místo toho použít /reference
<target
state=
"new"
>
Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"IDS_FeatureRefConditional"
>
<source>
ref conditional expression
</source>
<target
state=
"new"
>
ref conditional expression
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Um die Warnung zu beheben, können Sie stattdessen /reference verwenden (Einbett
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Para eliminar la advertencia puede usar /reference (establezca la propiedad Embe
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Pour supprimer l'avertissement, vous pouvez utiliser la commande /reference (dé
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Per rimuovere l'avviso, è invece possibile usare /reference (impostare la propr
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<target
state=
"new"
>
Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"IDS_FeatureRefConditional"
>
<source>
ref conditional expression
</source>
<target
state=
"new"
>
ref conditional expression
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<target
state=
"new"
>
Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"IDS_FeatureRefConditional"
>
<source>
ref conditional expression
</source>
<target
state=
"new"
>
ref conditional expression
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Aby usunąć ostrzeżenie, możesz zamiast tego użyć opcji /reference (ustaw w
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Para incorporar informações de tipo de interoperabilidade para os dois assembl
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<target state="new">Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.</target>
<note />
</trans-unit>
<trans-unit id="IDS_FeatureRefConditional">
<source>ref conditional expression</source>
<target state="new">ref conditional expression</target>
<note />
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ Uyarıyı kaldırmak için, /reference kullanabilirsiniz (Birlikte Çalışma T
<target
state=
"new"
>
Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"IDS_FeatureRefConditional"
>
<source>
ref conditional expression
</source>
<target
state=
"new"
>
ref conditional expression
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hans.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<target
state=
"new"
>
Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"IDS_FeatureRefConditional"
>
<source>
ref conditional expression
</source>
<target
state=
"new"
>
ref conditional expression
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Portable/xlf/CSharpResources.zh-Hant.xlf
浏览文件 @
91fa14da
...
...
@@ -8590,6 +8590,11 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<target
state=
"new"
>
Arguments with 'in' modifier cannot be used in dynamically dispatched expessions.
</target>
<note
/>
</trans-unit>
<trans-unit
id=
"IDS_FeatureRefConditional"
>
<source>
ref conditional expression
</source>
<target
state=
"new"
>
ref conditional expression
</target>
<note
/>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenRefConditionalOperatorTests.cs
浏览文件 @
91fa14da
...
...
@@ -636,6 +636,37 @@ static void Main()
);
}
[
Fact
]
[
WorkItem
(
24306
,
"https://github.com/dotnet/roslyn/issues/24306"
)]
public
void
TestRefConditional_71
()
{
var
source
=
@"
class C
{
static void Main()
{
}
void Test()
{
int local1 = 1;
int local2 = 2;
bool b = true;
ref int r = ref b? ref local1: ref local2;
}
}
"
;
var
comp
=
CreateCompilationWithMscorlib45
(
source
,
options
:
TestOptions
.
ReleaseExe
,
parseOptions
:
TestOptions
.
Regular7_1
);
comp
.
VerifyEmitDiagnostics
(
// (15,25): error CS8302: Feature 'ref conditional expression' is not available in C# 7.1. Please use language version 7.2 or greater.
// ref int r = ref b? ref local1: ref local2;
Diagnostic
(
ErrorCode
.
ERR_FeatureNotAvailableInVersion7_1
,
"b? ref local1: ref local2"
).
WithArguments
(
"ref conditional expression"
,
"7.2"
).
WithLocation
(
15
,
25
)
);
}
[
Fact
]
public
void
TestRefConditionalUnsafeToReturn1
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录