Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main to main-vs-deps #54001

Merged
7 commits merged into from
Jun 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Language Feature Status.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ efforts behind them.
| [Record structs](https://github.com/dotnet/csharplang/issues/4334) | [record-structs](https://github.com/dotnet/roslyn/tree/features/record-structs) | [In Progress](https://github.com/dotnet/roslyn/issues/51199) | [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs), [RikkiGibson](https://github.com/RikkiGibson) | [jcouv](https://github.com/jcouv) |
| [Global Using Directive](https://github.com/dotnet/csharplang/issues/3428) | [GlobalUsingDirective](https://github.com/dotnet/roslyn/tree/features/GlobalUsingDirective) | [In Progress](https://github.com/dotnet/roslyn/issues/51307) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [cston](https://github.com/cston) | [AlekseyTs](https://github.com/AlekseyTs) |
| [Static Abstract Members In Interfaces](https://github.com/dotnet/csharplang/issues/4436) | [StaticAbstractMembersInInterfaces](https://github.com/dotnet/roslyn/tree/features/StaticAbstractMembersInInterfaces) | [In Progress](https://github.com/dotnet/roslyn/issues/52221) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [RikkiGibson](https://github.com/RikkiGibson) | [MadsTorgersen](https://github.com/MadsTorgersen) |
| [File-scoped namespace](https://github.com/dotnet/csharplang/issues/137) | [FileScopedNamespaces](https://github.com/dotnet/roslyn/tree/features/FileScopedNamespaces) | In Progress | [chsienki](https://github.com/chsienki) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
| [File-scoped namespace](https://github.com/dotnet/csharplang/issues/137) | [FileScopedNamespaces](https://github.com/dotnet/roslyn/tree/features/FileScopedNamespaces) | In Progress | [RikkiGibson](https://github.com/RikkiGibson) | [jcouv](https://github.com/jcouv), [chsienki](https://github.com/chsienki) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) |
| [Interpolated string improvements](https://github.com/dotnet/csharplang/issues/4487) | [interpolated-string](https://github.com/dotnet/roslyn/tree/features/interpolated-string) | [In Progress](https://github.com/dotnet/roslyn/issues/51499) | [333fred](https://github.com/333fred) | [AlekseyTs](https://github.com/AlekseyTs), [chsienki](https://github.com/chsienki) | [jaredpar](https://github.com/jaredpar) |
| [Parameterless struct constructors](https://github.com/dotnet/csharplang/issues/99) | [struct-ctors](https://github.com/dotnet/roslyn/tree/features/struct-ctors) | [In Progress](https://github.com/dotnet/roslyn/issues/51698) | [cston](https://github.com/cston) | [jcouv](https://github.com/jcouv), [333fred](https://github.com/333fred) | [jcouv](https://github.com/jouv) |
| [Lambda improvements](https://github.com/dotnet/csharplang/blob/main/proposals/lambda-improvements.md) | [lambdas](https://github.com/dotnet/roslyn/tree/features/lambdas) | [In Progress](https://github.com/dotnet/roslyn/issues/52192) | [cston](https://github.com/cston) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [jaredpar](https://github.com/jaredpar) |
Expand Down
6 changes: 3 additions & 3 deletions eng/test-build-correctness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ try {

# Verify no PROTOTYPE marker left in main
if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH -eq "main") {
Write-Host "Checking no PROTOTYPE markers in compiler source"
$prototypes = Get-ChildItem -Path src/Compilers/*.cs, src/Compilers/*.vb,src/Compilers/*.xml -Recurse | Select-String -Pattern 'PROTOTYPE' -CaseSensitive -SimpleMatch
Write-Host "Checking no PROTOTYPE markers in source"
$prototypes = Get-ChildItem -Path src, eng, scripts -Exclude *.dll,*.exe,*.pdb,*.xlf,test-build-correctness.ps1 -Recurse | Select-String -Pattern 'PROTOTYPE' -CaseSensitive -SimpleMatch
if ($prototypes) {
Write-Host "Found PROTOTYPE markers in compiler source:"
Write-Host "Found PROTOTYPE markers in source:"
Write-Host $prototypes
throw "PROTOTYPE markers disallowed in compiler source"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ private static bool CanHaveInheritanceTarget(ISymbol symbol)
return false;
}

if (symbol is INamedTypeSymbol or IEventSymbol or IPropertySymbol ||
symbol.IsOrdinaryMethod())
if (symbol is INamedTypeSymbol or IEventSymbol or IPropertySymbol
or IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.ExplicitInterfaceImplementation })
{
return true;
}
Expand Down
87 changes: 73 additions & 14 deletions src/EditorFeatures/Test/InheritanceMargin/InheritanceMarginTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Immutable;
using System.Linq;
using System.Security;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;
Expand Down Expand Up @@ -33,6 +32,9 @@ private static Task VerifyInSingleDocumentAsync(
string languageName,
params TestInheritanceMemberItem[] memberItems)
{
markup = @$"<![CDATA[
{markup}]]>";

var workspaceFile = $@"
<Workspace>
<Project Language=""{languageName}"" CommonReferences=""true"">
Expand Down Expand Up @@ -138,12 +140,14 @@ private static async Task VerifyInDifferentProjectsAsync(
<Project Language=""{markup1.languageName}"" AssemblyName=""Assembly1"" CommonReferences=""true"">
<ProjectReference>Assembly2</ProjectReference>
<Document>
{markup1.markupInProject1}
<![CDATA[
{markup1.markupInProject1}]]>
</Document>
</Project>
<Project Language=""{markup2.languageName}"" AssemblyName=""Assembly2"" CommonReferences=""true"">
<Document>
{markup2.markupInProject2}
<![CDATA[
{markup2.markupInProject2}]]>
</Document>
</Project>
</Workspace>";
Expand Down Expand Up @@ -933,18 +937,16 @@ public class {|target5:Bar2|} : Bar1, IBar
[Fact]
public Task TestCSharpFindGenericsBaseType()
{
var lessThanToken = SecurityElement.Escape("<");
var greaterThanToken = SecurityElement.Escape(">");
var markup = $@"
public interface {{|target2:IBar|}}{lessThanToken}T{greaterThanToken}
{{
void {{|target4:Foo|}}();
}}
var markup = @"
public interface {|target2:IBar|}<T>
{
void {|target4:Foo|}();
}

public class {{|target1:Bar2|}} : IBar{lessThanToken}int{greaterThanToken}, IBar{lessThanToken}string{greaterThanToken}
{{
public void {{|target3:Foo|}}();
}}";
public class {|target1:Bar2|} : IBar<int>, IBar<string>
{
public void {|target3:Foo|}();
}";

var itemForIBar = new TestInheritanceMemberItem(
lineNumber: 2,
Expand Down Expand Up @@ -989,6 +991,63 @@ public class {{|target1:Bar2|}} : IBar{lessThanToken}int{greaterThanToken}, IBar
itemForFooInBar2);
}

[Fact]
public Task TestCSharpExplicitInterfaceImplementation()
{
var markup = @"
interface {|target2:IBar|}<T>
{
void {|target3:Foo|}(T t);
}

abstract class {|target1:AbsBar|} : IBar<int>
{
void IBar<int>.{|target4:Foo|}(int t)
{
throw new System.NotImplementedException();
}
}";
var itemForIBar = new TestInheritanceMemberItem(
lineNumber: 2,
memberName: "interface IBar<T>",
targets: ImmutableArray.Create(new TargetInfo(
targetSymbolDisplayName: "class AbsBar",
locationTag: "target1",
relationship: InheritanceRelationship.Implemented)));

var itemForFooInIBar = new TestInheritanceMemberItem(
lineNumber: 4,
memberName: "void IBar<T>.Foo(T)",
targets: ImmutableArray.Create(new TargetInfo(
targetSymbolDisplayName: "void AbsBar.IBar<int>.Foo(int)",
locationTag: "target4",
relationship: InheritanceRelationship.Implemented)));

var itemForAbsBar = new TestInheritanceMemberItem(
lineNumber: 7,
memberName: "class AbsBar",
targets: ImmutableArray.Create(new TargetInfo(
targetSymbolDisplayName: "interface IBar<T>",
locationTag: "target2",
relationship: InheritanceRelationship.Implementing)));

var itemForFooInAbsBar = new TestInheritanceMemberItem(
lineNumber: 9,
memberName: "void AbsBar.IBar<int>.Foo(int)",
targets: ImmutableArray.Create(new TargetInfo(
targetSymbolDisplayName: "void IBar<T>.Foo(T)",
locationTag: "target3",
relationship: InheritanceRelationship.Implementing)));

return VerifyInSingleDocumentAsync(
markup,
LanguageNames.CSharp,
itemForIBar,
itemForFooInIBar,
itemForAbsBar,
itemForFooInAbsBar);
}

#endregion

#region TestsForVisualBasic
Expand Down