未验证 提交 dc5d6faa 编写于 作者: A Andy Gocke 提交者: GitHub

Merge pull request #24383 from dotnet/merges/dev15.6.x-to-dev15.7.x-20180123-080009

Merge dev15.6.x to dev15.7.x
......@@ -4,7 +4,7 @@
<PropertyGroup>
<!-- xUnit.net Console Runner -->
<XUnitPath>$(NuGetPackageRoot)\xunit.runner.console\$(xunitrunnerconsoleVersion)\tools\xunit.console.x86.exe</XUnitPath>
<XUnitPath>$(NuGetPackageRoot)\xunit.runner.console\$(xunitrunnerconsoleVersion)\tools\net452\xunit.console.x86.exe</XUnitPath>
<XUnitTestResultsDirectory>$(OutDir)\xUnitResults</XUnitTestResultsDirectory>
<XUnitArguments>"$(OutDir)\$(AssemblyName).dll" -html "$(XUnitTestResultsDirectory)\$(AssemblyName).html" -noshadow</XUnitArguments>
<PrepareForBuildDependsOn>$(PrepareForBuildDependsOn);AddDefaultTestAppConfig</PrepareForBuildDependsOn>
......
......@@ -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);
......
......@@ -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>
......
......@@ -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>
......
......@@ -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.
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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
......@@ -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()
{
......
......@@ -52,6 +52,52 @@ void Goo()
await TestAsync(markup, expectedOrderedItems);
}
[Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)]
[WorkItem(24311, "https://github.com/dotnet/roslyn/issues/24311")]
public async Task TestInvocationWithParametersOn1_WithRefReturn()
{
var markup = @"
class C
{
public ref int this[int a]
{
get { throw null; }
}
void Goo(C c)
{
[|c[$$]|]
}
}";
var expectedOrderedItems = new List<SignatureHelpTestItem>();
expectedOrderedItems.Add(new SignatureHelpTestItem("ref int C[int a]", string.Empty, string.Empty, currentParameterIndex: 0));
await TestAsync(markup, expectedOrderedItems);
}
[Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)]
[WorkItem(24311, "https://github.com/dotnet/roslyn/issues/24311")]
public async Task TestInvocationWithParametersOn1_WithRefReadonlyReturn()
{
var markup = @"
class C
{
public ref readonly int this[int a]
{
get { throw null; }
}
void Goo(C c)
{
[|c[$$]|]
}
}";
var expectedOrderedItems = new List<SignatureHelpTestItem>();
expectedOrderedItems.Add(new SignatureHelpTestItem("ref readonly int C[int a]", string.Empty, string.Empty, currentParameterIndex: 0));
await TestAsync(markup, expectedOrderedItems);
}
[WorkItem(636117, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/636117")]
[Fact, Trait(Traits.Feature, Traits.Features.SignatureHelp)]
public async Task TestInvocationOnExpression()
......
......@@ -246,6 +246,19 @@ public override SignatureHelpState GetCurrentArgumentState(SyntaxNode root, int
{
var result = new List<SymbolDisplayPart>();
if (indexer.ReturnsByRef)
{
result.Add(Keyword(SyntaxKind.RefKeyword));
result.Add(Space());
}
else if (indexer.ReturnsByRefReadonly)
{
result.Add(Keyword(SyntaxKind.RefKeyword));
result.Add(Space());
result.Add(Keyword(SyntaxKind.ReadOnlyKeyword));
result.Add(Space());
}
result.AddRange(indexer.Type.ToMinimalDisplayParts(semanticModel, position));
result.Add(Space());
result.AddRange(indexer.ContainingType.ToMinimalDisplayParts(semanticModel, position));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册