Skip to content

Commit

Permalink
Merge pull request dotnet#22071 from gafter/ppmerge8
Browse files Browse the repository at this point in the history
Merge master into privateProtected branch
  • Loading branch information
gafter authored Sep 12, 2017
2 parents fd2ba30 + 875664a commit 59d5885
Show file tree
Hide file tree
Showing 218 changed files with 956 additions and 2,278 deletions.
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
###############################################################################
* text=auto encoding=UTF-8

# csc/vbc are shell scripts and should always have unix line endings
# RunCsc/RunVbc are shell scripts and should always have unix line endings
# These shell scripts are included in the toolset packages. Normally, the shell
# scripts in our repo are only run by cloning onto a Linux/Mac machine, and git
# automatically chooses LF as the line ending.
#
# However, right now the toolset packages must be built on Windows, and so the
# files must be hard-coded to be cloned with LF
src/Compilers/CSharp/CscCore/csc text eol=lf
src/Compilers/VisualBasic/VbcCore/vbc text eol=lf
build/NuGetAdditionalFiles/RunCsc text eol=lf
build/NuGetAdditionalFiles/RunVbc text eol=lf
*.sh text eol=lf

###############################################################################
# Set default behavior for command prompt diff.
Expand Down
16 changes: 1 addition & 15 deletions Roslyn.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26621.2
VisualStudioVersion = 15.0.26815.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{A41D1B99-F489-4C43-BBDF-96D61B19A6B9}"
EndProject
Expand Down Expand Up @@ -297,8 +297,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Perf.Tests", "src\Test\Perf
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn", "src\Deployment\Roslyn.csproj", "{600AF682-E097-407B-AD85-EE3CED37E680}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EditorFeatures.Next", "src\EditorFeatures\Next\EditorFeatures.Next.csproj", "{366BBCDC-B05F-4677-9B5B-78BA816A1484}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualStudioSetup.Next", "src\VisualStudio\Setup.Next\VisualStudioSetup.Next.csproj", "{143FE684-6E1C-41DF-9C60-84C7772DC49C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XamlVisualStudio", "src\VisualStudio\Xaml\Impl\XamlVisualStudio.csproj", "{971E832B-7471-48B5-833E-5913188EC0E4}"
Expand All @@ -321,8 +319,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MSBuildTask", "src\Compiler
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RemoteHostClientMock", "src\VisualStudio\RemoteHostClientMock\RemoteHostClientMock.csproj", "{7259740A-FD0E-480F-A7D4-08BE90AC9051}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ServicesVisualStudio.Next", "src\VisualStudio\Core\Next\ServicesVisualStudio.Next.csproj", "{FE0D4BDD-1C30-488E-A870-854F5B8C5014}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualStudioTest.Next", "src\VisualStudio\Core\Test.Next\VisualStudioTest.Next.csproj", "{2E1658E2-5045-4F85-A64C-C0ECCD39F719}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildBoss", "src\Tools\BuildBoss\BuildBoss.csproj", "{9C0660D9-48CA-40E1-BABA-8F6A1F11FE10}"
Expand Down Expand Up @@ -849,10 +845,6 @@ Global
{600AF682-E097-407B-AD85-EE3CED37E680}.Debug|Any CPU.Build.0 = Debug|Any CPU
{600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.ActiveCfg = Release|Any CPU
{600AF682-E097-407B-AD85-EE3CED37E680}.Release|Any CPU.Build.0 = Release|Any CPU
{366BBCDC-B05F-4677-9B5B-78BA816A1484}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{366BBCDC-B05F-4677-9B5B-78BA816A1484}.Debug|Any CPU.Build.0 = Debug|Any CPU
{366BBCDC-B05F-4677-9B5B-78BA816A1484}.Release|Any CPU.ActiveCfg = Release|Any CPU
{366BBCDC-B05F-4677-9B5B-78BA816A1484}.Release|Any CPU.Build.0 = Release|Any CPU
{143FE684-6E1C-41DF-9C60-84C7772DC49C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{143FE684-6E1C-41DF-9C60-84C7772DC49C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{143FE684-6E1C-41DF-9C60-84C7772DC49C}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -889,10 +881,6 @@ Global
{7259740A-FD0E-480F-A7D4-08BE90AC9051}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7259740A-FD0E-480F-A7D4-08BE90AC9051}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7259740A-FD0E-480F-A7D4-08BE90AC9051}.Release|Any CPU.Build.0 = Release|Any CPU
{FE0D4BDD-1C30-488E-A870-854F5B8C5014}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE0D4BDD-1C30-488E-A870-854F5B8C5014}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE0D4BDD-1C30-488E-A870-854F5B8C5014}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE0D4BDD-1C30-488E-A870-854F5B8C5014}.Release|Any CPU.Build.0 = Release|Any CPU
{2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E1658E2-5045-4F85-A64C-C0ECCD39F719}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -1128,7 +1116,6 @@ Global
{E5A55C16-A5B9-4874-9043-A5266DC02F58} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70}
{3BED15FD-D608-4573-B432-1569C1026F6D} = {CC126D03-7EAC-493F-B187-DCDEE1EF6A70}
{DA0D2A70-A2F9-4654-A99A-3227EDF54FF1} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5}
{366BBCDC-B05F-4677-9B5B-78BA816A1484} = {EE97CB90-33BB-4F3A-9B3D-69375DEC6AC6}
{143FE684-6E1C-41DF-9C60-84C7772DC49C} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{971E832B-7471-48B5-833E-5913188EC0E4} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{59AD474E-2A35-4E8A-A74D-E33479977FBF} = {DD13507E-D5AF-4B61-B11A-D55D6F4A73A5}
Expand All @@ -1140,7 +1127,6 @@ Global
{1CA184D3-89CB-4074-BEC5-F8AEBA657D41} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{7AD4FE65-9A30-41A6-8004-AA8F89BCB7F3} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9}
{7259740A-FD0E-480F-A7D4-08BE90AC9051} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{FE0D4BDD-1C30-488E-A870-854F5B8C5014} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{2E1658E2-5045-4F85-A64C-C0ECCD39F719} = {8DBA5174-B0AA-4561-82B1-A46607697753}
{9C0660D9-48CA-40E1-BABA-8F6A1F11FE10} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{21A01C2D-2501-4619-8144-48977DD22D9C} = {38940C5F-97FD-4B2A-B2CD-C4E4EF601B05}
Expand Down
2 changes: 0 additions & 2 deletions build/config/SignToolData.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"Dlls\\CodeStyle\\Microsoft.CodeAnalysis.CodeStyle.dll",
"Dlls\\CodeStyleFixes\\Microsoft.CodeAnalysis.CodeStyle.Fixes.dll",
"Dlls\\Diagnostics\\Roslyn.Hosting.Diagnostics.dll",
"Dlls\\EditorFeatures.Next\\Microsoft.CodeAnalysis.EditorFeatures.Next.dll",
"Dlls\\EditorFeatures\\Microsoft.CodeAnalysis.EditorFeatures.dll",
"Dlls\\Features\\Microsoft.CodeAnalysis.Features.dll",
"Dlls\\InteractiveEditorFeatures\\Microsoft.CodeAnalysis.InteractiveEditorFeatures.dll",
Expand All @@ -37,7 +36,6 @@
"Dlls\\RemoteWorkspaces\\Microsoft.CodeAnalysis.Remote.Workspaces.dll",
"Dlls\\Scripting\\Microsoft.CodeAnalysis.Scripting.dll",
"Dlls\\ServiceHub\\Microsoft.CodeAnalysis.Remote.ServiceHub.dll",
"Dlls\\ServicesVisualStudio.Next\\Microsoft.VisualStudio.LanguageServices.Next.dll",
"Dlls\\ServicesVisualStudioImpl\\Microsoft.VisualStudio.LanguageServices.Implementation.dll",
"Dlls\\ServicesVisualStudio\\Microsoft.VisualStudio.LanguageServices.dll",
"Dlls\\SolutionExplorerShim\\Microsoft.VisualStudio.LanguageServices.SolutionExplorer.dll",
Expand Down
6 changes: 5 additions & 1 deletion docs/Language Feature Status.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ efforts behind them.
| [ref readonly](https://github.com/dotnet/csharplang/blob/master/proposals/readonly-ref.md) | [readonly-ref](https://github.com/dotnet/roslyn/tree/features/readonly-ref) | Prototype | [vsadov](https://github.com/vsadov), [omar](https://github.com/OmarTawfikw) | [cston](https://github.com/cston),[gafter](https://github.com/gafter) | [jaredpar](https://github.com/jaredpar) |
| [blittable](https://github.com/dotnet/csharplang/pull/206) | None | Proposal | None | | [jaredpar](https://github.com/jaredpar) |
| strongname | [strongname](https://github.com/dotnet/roslyn/tree/features/strongname) | In Progress | [Ty Overby](https://github.com/tyoverby) | | [jaredpar](https://github.com/jaredpar) |
| [interior pointer](https://github.com/dotnet/csharplang/pull/264) | None | Proposal | [vsadov](https://github.com/vsadov) | [jaredpar](https://github.com/jaredpar) | [jaredpar](https://github.com/jaredpar) |
| [interior pointer/Span<T>/ref struct](https://github.com/dotnet/csharplang/pull/264) | None | In Progress | [vsadov](https://github.com/vsadov) | [gafter](https://github.com/gafter), [jaredpar](https://github.com/jaredpar) | [jaredpar](https://github.com/jaredpar) |
| [non-trailing named arguments](https://github.com/dotnet/csharplang/blob/master/proposals/non-trailing-named-arguments.md) | master | Merged | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) |
| [private protected](https://github.com/dotnet/csharplang/blob/master/proposals/private-protected.md) | [privateProtected](https://github.com/dotnet/roslyn/tree/features/privateProtected) | In Progress | [gafter](https://github.com/gafter) | [jcouv](https://github.com/jcouv) | [gafter](https://github.com/gafter) |
| [conditional ref operator](https://github.com/dotnet/csharplang/blob/master/proposals/conditional-ref.md) | [readonly-ref](https://github.com/dotnet/roslyn/tree/features/readonly-ref) | In Progress | [vsadov](https://github.com/vsadov) | [cston](https://github.com/cston) | [jaredpar](https://github.com/jaredpar) |



# C# 8.0

| Feature | Branch | State | Developers | Reviewer | LDM Champ |
| ------- | ------ | ----- | ---------- | -------- | --------- |
| [Default Interface Methods](https://github.com/dotnet/csharplang/blob/master/proposals/default-interface-methods.md) | [defaultInterfaceImplementation](https://github.com/dotnet/roslyn/tree/features/DefaultInterfaceImplementation) | Prototype | [AlekseyTs](https://github.com/AlekseyTs) | [gafter](https://github.com/gafter) | [gafter](https://github.com/gafter) |
| [Nullable reference type](https://github.com/dotnet/roslyn/blob/features/NullableReferenceTypes/docs/features/NullableReferenceTypes/Nullable%20reference%20types.md) | [NullableReferenceTypes](https://github.com/dotnet/roslyn/tree/features/NullableReferenceTypes) | Prototype | [cston](https://github.com/cston), [AlekseyTs](https://github.com/AlekseyTs) | | [mattwar](https://github.com/mattwar) |
| [recursive patterns](https://github.com/dotnet/csharplang/blob/master/proposals/patterns.md) | | Ready for prototype | [gafter](https://github.com/gafter) | | [gafter](https://github.com/gafter) |

# FAQ

Expand Down
106 changes: 30 additions & 76 deletions src/Compilers/CSharp/Portable/Parser/LanguageParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,25 +1414,6 @@ private bool IsPossibleMemberName()
}
}

private static bool CanReuseTypeDeclaration(CSharp.Syntax.MemberDeclarationSyntax member)
{
if (member != null)
{
// on reuse valid type declaration (not bad namespace members)
switch (member.Kind())
{
case SyntaxKind.ClassDeclaration:
case SyntaxKind.StructDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.DelegateDeclaration:
return true;
}
}

return false;
}

private MemberDeclarationSyntax ParseTypeDeclaration(SyntaxListBuilder<AttributeListSyntax> attributes, SyntaxListBuilder modifiers)
{
// "top-level" expressions and statements should never occur inside an asynchronous context
Expand Down Expand Up @@ -1521,7 +1502,7 @@ private TypeDeclarationSyntax ParseClassOrStructOrInterfaceDeclaration(SyntaxLis
var saveTerm2 = _termState;
_termState |= TerminatorState.IsPossibleMemberStartOrStop;

var memberOrStatement = this.ParseMemberDeclarationOrStatement(classOrStructOrInterface.Kind, name.ValueText);
var memberOrStatement = this.ParseMemberDeclarationOrStatement(classOrStructOrInterface.Kind);
if (memberOrStatement != null)
{
// statements are accepted here, a semantic error will be reported later
Expand Down Expand Up @@ -1968,56 +1949,33 @@ private static bool CanStartTypeDeclaration(SyntaxKind kind)
}

private static bool CanReuseMemberDeclaration(
CSharp.Syntax.MemberDeclarationSyntax member,
string typeName)
{
if (member != null)
{
switch (member.Kind())
{
case SyntaxKind.ClassDeclaration:
case SyntaxKind.StructDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.DelegateDeclaration:
case SyntaxKind.FieldDeclaration:
case SyntaxKind.EventFieldDeclaration:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.EventDeclaration:
case SyntaxKind.IndexerDeclaration:
case SyntaxKind.OperatorDeclaration:
case SyntaxKind.ConversionOperatorDeclaration:
case SyntaxKind.DestructorDeclaration:
return true;
}

var parent = GetOldParent(member);
var originalTypeDeclaration = parent as CSharp.Syntax.TypeDeclarationSyntax;

// originalTypeDeclaration can be null in the case of script code. In that case
// the member declaration can be a child of a namespace/compilation-unit instead of
// a type.
if (originalTypeDeclaration != null)
{
switch (member.Kind())
{
case SyntaxKind.MethodDeclaration:
// can reuse a method as long as it *doesn't* match the type name.
var methodDeclaration = (CSharp.Syntax.MethodDeclarationSyntax)member;
return methodDeclaration.Identifier.ValueText != typeName;

case SyntaxKind.ConstructorDeclaration:
// can reuse constructors if the name and type name still match.
return originalTypeDeclaration.Identifier.ValueText == typeName;
}
}
CSharp.Syntax.MemberDeclarationSyntax member)
{
switch (member?.Kind())
{
case SyntaxKind.ClassDeclaration:
case SyntaxKind.StructDeclaration:
case SyntaxKind.InterfaceDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.DelegateDeclaration:
case SyntaxKind.FieldDeclaration:
case SyntaxKind.EventFieldDeclaration:
case SyntaxKind.PropertyDeclaration:
case SyntaxKind.EventDeclaration:
case SyntaxKind.IndexerDeclaration:
case SyntaxKind.OperatorDeclaration:
case SyntaxKind.ConversionOperatorDeclaration:
case SyntaxKind.DestructorDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.ConstructorDeclaration:
return true;
default:
return false;
}

return false;
}

// Returns null if we can't parse anything (even partially).
private MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind parentKind, string typeName = null)
private MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind parentKind)
{
// "top-level" expressions and statements should never occur inside an asynchronous context
Debug.Assert(!IsInAsync);
Expand All @@ -2028,12 +1986,10 @@ private MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind par
bool acceptStatement = isGlobalScript;

// don't reuse members if they were previously declared under a different type keyword kind
// don't reuse existing constructors & destructors because they have to match typename errors
// don't reuse methods whose name matches the new type name (they now match as possible constructors)
if (this.IsIncrementalAndFactoryContextMatches)
{
var member = this.CurrentNode as CSharp.Syntax.MemberDeclarationSyntax;
if (CanReuseMemberDeclaration(member, typeName) || CanReuseTypeDeclaration(member))
if (CanReuseMemberDeclaration(member))
{
return (MemberDeclarationSyntax)this.EatNode();
}
Expand Down Expand Up @@ -2118,9 +2074,9 @@ private MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind par
// Script(...) { ... }
// ^
// missing ';'
if (!isGlobalScript && this.CurrentToken.ValueText == typeName)
if (!isGlobalScript)
{
return this.ParseConstructorDeclaration(typeName, attributes, modifiers);
return this.ParseConstructorDeclaration(attributes, modifiers);
}

// Script:
Expand All @@ -2141,7 +2097,7 @@ private MemberDeclarationSyntax ParseMemberDeclarationOrStatement(SyntaxKind par
// TODO: better error messages for script
if (!isGlobalScript && this.CurrentToken.Kind == SyntaxKind.TildeToken)
{
return this.ParseDestructorDeclaration(typeName, attributes, modifiers);
return this.ParseDestructorDeclaration(attributes, modifiers);
}

// Check for constant (prefers const field over const local variable decl)
Expand Down Expand Up @@ -2502,11 +2458,9 @@ public static bool IsComplete(CSharpSyntaxNode node)
}

private ConstructorDeclarationSyntax ParseConstructorDeclaration(
string typeName, SyntaxListBuilder<AttributeListSyntax> attributes, SyntaxListBuilder modifiers)
SyntaxListBuilder<AttributeListSyntax> attributes, SyntaxListBuilder modifiers)
{
var name = this.ParseIdentifierToken();
Debug.Assert(name.ValueText == typeName);

var saveTerm = _termState;
_termState |= TerminatorState.IsEndOfMethodSignature;
try
Expand Down Expand Up @@ -2566,7 +2520,7 @@ private ConstructorInitializerSyntax ParseConstructorInitializer()
return _syntaxFactory.ConstructorInitializer(kind, colon, token, argumentList);
}

private DestructorDeclarationSyntax ParseDestructorDeclaration(string typeName, SyntaxListBuilder<AttributeListSyntax> attributes, SyntaxListBuilder modifiers)
private DestructorDeclarationSyntax ParseDestructorDeclaration(SyntaxListBuilder<AttributeListSyntax> attributes, SyntaxListBuilder modifiers)
{
Debug.Assert(this.CurrentToken.Kind == SyntaxKind.TildeToken);
var tilde = this.EatToken(SyntaxKind.TildeToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ private SourceConstructorSymbol(
var declarationModifiers = this.MakeModifiers(syntax.Modifiers, methodKind, location, diagnostics, out modifierErrors);
this.MakeFlags(methodKind, declarationModifiers, returnsVoid: true, isExtensionMethod: false);

if (syntax.Identifier.ValueText != containingType.Name)
{
// This is probably a method declaration with the type missing.
diagnostics.Add(ErrorCode.ERR_MemberNeedsType, location);
}

bool hasBlockBody = syntax.Body != null;
_isExpressionBodied = !hasBlockBody && syntax.ExpressionBody != null;

Expand Down
Loading

0 comments on commit 59d5885

Please sign in to comment.