Skip to content

Commit

Permalink
Merge branch 'master' into embed-source-in-pdb
Browse files Browse the repository at this point in the history
Conflicts:
 src/Workspaces/Core/Portable/WorkspacesResources.resx
  • Loading branch information
nguerrera committed Aug 11, 2016
2 parents fff3927 + 8c3ff5b commit c5d42df
Show file tree
Hide file tree
Showing 86 changed files with 2,129 additions and 1,032 deletions.
4 changes: 0 additions & 4 deletions Compilers.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VisualBasicErrorFactsGenera
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AnalyzerDriver", "src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.shproj", "{D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedCollections", "src\Compilers\Core\SharedCollections\SharedCollections.shproj", "{C1930979-C824-496B-A630-70F5369A636F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpWinRTTest", "src\Compilers\CSharp\Test\WinRT\CSharpWinRTTest.csproj", "{FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vbc", "src\Compilers\VisualBasic\vbc\vbc.csproj", "{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1}"
Expand Down Expand Up @@ -142,7 +140,6 @@ Global
src\Dependencies\CodeAnalysis.Metadata\Microsoft.CodeAnalysis.Metadata.projitems*{afde6bea-5038-4a4a-a88e-dbd2e4088eed}*SharedItemsImports = 4
src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{afde6bea-5038-4a4a-a88e-dbd2e4088eed}*SharedItemsImports = 4
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{b501a547-c911-4a05-ac6e-274a50dff30e}*SharedItemsImports = 4
src\Compilers\Core\SharedCollections\SharedCollections.projitems*{c1930979-c824-496b-a630-70f5369a636f}*SharedItemsImports = 13
src\Test\Utilities\Shared\TestUtilities.projitems*{ccbd3438-3e84-40a9-83ad-533f23bcfca5}*SharedItemsImports = 4
src\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems*{cd77a8cc-2885-47a7-b99c-fbf13353400b}*SharedItemsImports = 13
src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{d0bc9be7-24f6-40ca-8dc6-fcb93bd44b34}*SharedItemsImports = 13
Expand Down Expand Up @@ -1052,7 +1049,6 @@ Global
{6AA96934-D6B7-4CC8-990D-DB6B9DD56E34} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{909B656F-6095-4AC2-A5AB-C3F032315C45} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC}
{D0BC9BE7-24F6-40CA-8DC6-FCB93BD44B34} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9}
{C1930979-C824-496B-A630-70F5369A636F} = {A41D1B99-F489-4C43-BBDF-96D61B19A6B9}
{FCFA8808-A1B6-48CC-A1EA-0B8CA8AEDA8E} = {32A48625-F0AD-419D-828B-A50BDABA38EA}
{E58EE9D7-1239-4961-A0C1-F9EC3952C4C1} = {C65C6143-BED3-46E6-869E-9F0BE6E84C37}
{E3CD2895-76A8-4D11-A316-EA67CB5EA42C} = {32A48625-F0AD-419D-828B-A50BDABA38EA}
Expand Down
2 changes: 1 addition & 1 deletion build/Targets/Dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<SystemNetSocketsVersion>4.1.0</SystemNetSocketsVersion>
<SystemReflectionVersion>4.1.0</SystemReflectionVersion>
<SystemReflectionExtensionsVersion>4.0.1</SystemReflectionExtensionsVersion>
<SystemReflectionMetadataVersion>1.4.1-beta-24322-03</SystemReflectionMetadataVersion>
<SystemReflectionMetadataVersion>1.4.1-beta-24410-02</SystemReflectionMetadataVersion>
<SystemReflectionPrimitivesVersion>4.0.1</SystemReflectionPrimitivesVersion>
<SystemReflectionTypeExtensionsVersion>4.1.0</SystemReflectionTypeExtensionsVersion>
<SystemResourcesResourceManagerVersion>4.0.1</SystemResourcesResourceManagerVersion>
Expand Down
27 changes: 5 additions & 22 deletions build/Targets/VSL.Imports.targets
Original file line number Diff line number Diff line change
Expand Up @@ -58,35 +58,18 @@
</Otherwise>
</Choose>

<!-- settings for strong name signing -->
<PropertyGroup>
<ShouldSignBuild Condition="'$(RealSignBuild)' == 'true' OR '$(SignType)' == 'real'">true</ShouldSignBuild>
</PropertyGroup>

<!-- Settings for strong name signing -->
<Choose>
<When Condition="'$(SignAssembly)' == 'true'">
<Choose>
<!-- Shipping binaries in an "official" build are delay-signed with the MS key; later, the signing
system will finish the strong-name signing. -->
<!-- Shipping binaries are always public signed. In the case of an official build $(OfficialBuild) the
binaries will be real signed as a post processing step. -->
<When Condition="'$(NonShipping)' != 'true'">
<Choose>
<!-- DelaySign if we're real signing, otherwise public sign -->
<When Condition="'$(ShouldSignBuild)' == 'true'">
<PropertyGroup>
<DelaySign>true</DelaySign>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<PublicSign>true</PublicSign>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup>
<AssemblyOriginatorKeyFile>$(VSLToolsPath)\Strong Name Keys\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(RoslynPublicKey)</PublicKey>
<PublicKeyToken>31BF3856AD364E35</PublicKeyToken>
<PublicSign>true</PublicSign>
</PropertyGroup>
</When>

Expand Down Expand Up @@ -207,7 +190,7 @@

<Target Name="VerifyBuildFlags">
<Error
Condition="('$(RealSignBuild)' == 'true' OR '$(SignType)' == 'real') AND '$(BuildVersion)' == '42.42.42.42'"
Condition="'$(OfficialBuild)' == 'true' AND '$(BuildVersion)' == '42.42.42.42'"
Text="Must specify a build version in order to real sign a build." />

<Error
Expand Down
10 changes: 2 additions & 8 deletions build/Targets/VSL.Versions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
<MicrosoftVisualStudioInteractiveWindowVersion>$(RoslynAssemblyVersionBase)</MicrosoftVisualStudioInteractiveWindowVersion>
</PropertyGroup>

<PropertyGroup>
<!-- We cannot sign an unofficial build, so fail if 'OfficialBuild' is not 'true' but 'SignedBuild' is -->
<SignedBuild Condition="'$(RealSignBuild)' == 'true' OR '$(SignType)' == 'real'">true</SignedBuild>
<Error Condition="'$(OfficialBuild)' != 'true' AND '$(SignedBuild)' == 'true'">Cannot sign an unofficial build.</Error>
</PropertyGroup>

<PropertyGroup>
<!-- We should not be signing a build anywhere except for in MicroBuild, which will always specify 'BUILD_BUILDNUMBER' -->
<BuildNumber Condition="'$(BuildNumber)' == ''">$(BUILD_BUILDNUMBER)</BuildNumber>
<Error Condition="'$(BuildNumber)' == '' AND '$(SignedBuild)' == 'true'">A build number must be specified for a signed build.</Error>
<Error Condition="'$(BuildNumber)' == '' AND '$(OfficialBuild)' == 'true'">A build number must be specified for a signed build.</Error>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -48,7 +42,7 @@
</PropertyGroup>

<Choose>
<When Condition="'$(OfficialBuild)' == 'true' OR '$(SignedBuild)' == 'true' OR '$(UseShippingAssemblyVersion)' == 'true'">
<When Condition="'$(OfficialBuild)' == 'true' OR '$(UseShippingAssemblyVersion)' == 'true'">
<PropertyGroup>
<AssemblyVersion>$(RoslynAssemblyVersionBase).0</AssemblyVersion>
<BuildVersion>$(RoslynFileVersionBase).$(BuildNumberFiveDigitDateStamp)</BuildVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ private UnboundLambda MakeQueryUnboundLambda(RangeVariableMap qvm, ImmutableArra
{
return MakeQueryUnboundLambda(expression, new QueryUnboundLambdaState(this, qvm, parameters, (LambdaSymbol lambdaSymbol, Binder lambdaBodyBinder, DiagnosticBag diagnostics) =>
{
return lambdaBodyBinder.BindLambdaExpressionAsBlock(RefKind.None, expression, diagnostics);
return lambdaBodyBinder.BindLambdaExpressionAsBlock(expression, diagnostics);
}));
}

Expand Down
10 changes: 6 additions & 4 deletions src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3661,13 +3661,15 @@ internal BoundBlock BindExpressionBodyAsBlock(ArrowExpressionClauseSyntax expres
/// <summary>
/// Binds a lambda with expression e as either { return e;} or { e; }.
/// </summary>
public BoundBlock BindLambdaExpressionAsBlock(RefKind refKind, ExpressionSyntax body, DiagnosticBag diagnostics)
public BoundBlock BindLambdaExpressionAsBlock(ExpressionSyntax body, DiagnosticBag diagnostics)
{
Binder bodyBinder = this.GetBinder(refKind != RefKind.None ? body.Parent : body);
Binder bodyBinder = this.GetBinder(body);
Debug.Assert(bodyBinder != null);

BoundExpression expression = bodyBinder.BindValue(body, diagnostics, refKind != RefKind.None ? BindValueKind.RefReturn : BindValueKind.RValue);
return bodyBinder.CreateBlockFromExpression(body, bodyBinder.GetDeclaredLocalsForScope(body), refKind, expression, body, diagnostics);
RefKind refKind;
var expressionSyntax = ((ExpressionSyntax)body).SkipRef(out refKind);
BoundExpression expression = bodyBinder.BindValue(expressionSyntax, diagnostics, refKind != RefKind.None ? BindValueKind.RefReturn : BindValueKind.RValue);
return bodyBinder.CreateBlockFromExpression(body, bodyBinder.GetDeclaredLocalsForScope(body), refKind, expression, expressionSyntax, diagnostics);
}

internal virtual ImmutableArray<LocalSymbol> Locals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ protected override ImmutableArray<LocalSymbol> BuildLocals()

internal override ImmutableArray<LocalSymbol> GetDeclaredLocalsForScope(CSharpSyntaxNode scopeDesignator)
{
if (ScopeDesignator == scopeDesignator ||
ScopeDesignator.Kind() == SyntaxKind.RefExpression && ScopeDesignator == scopeDesignator.Parent)
if (ScopeDesignator == scopeDesignator)
{
return this.Locals;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ private BoundPatternSwitchLabel BindPatternSwitchSectionLabel(
node, boundSwitchExpression, boundSwitchExpression.Type, caseLabelSyntax.Value, node.HasErrors, diagnostics, out wasExpression, wasSwitchCase: true);
bool hasErrors = pattern.HasErrors;
var constantValue = pattern.ConstantValue;
if (!hasErrors && (object)constantValue != null && this.FindMatchingSwitchCaseLabel(constantValue, caseLabelSyntax) != label)
if (!hasErrors &&
(object)constantValue != null &&
pattern.Value.Type == SwitchGoverningType &&
this.FindMatchingSwitchCaseLabel(constantValue, caseLabelSyntax) != label)
{
diagnostics.Add(ErrorCode.ERR_DuplicateCaseLabel, node.Location, pattern.ConstantValue.GetValueToDisplay() ?? label.Name);
hasErrors = true;
Expand All @@ -142,7 +145,7 @@ private BoundPatternSwitchLabel BindPatternSwitchSectionLabel(
bool hasErrors = pattern.HasErrors;
if (defaultLabel != null)
{
diagnostics.Add(ErrorCode.ERR_DuplicateCaseLabel, node.Location, "default");
diagnostics.Add(ErrorCode.ERR_DuplicateCaseLabel, node.Location, label.Name);
hasErrors = true;
}

Expand Down
4 changes: 1 addition & 3 deletions src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs
Original file line number Diff line number Diff line change
Expand Up @@ -890,9 +890,7 @@ protected override BoundBlock BindLambdaBody(LambdaSymbol lambdaSymbol, Binder l
{
if (this.IsExpressionLambda)
{
var refKind = CodeAnalysis.RefKind.None;
var body = ((ExpressionSyntax)this.Body).SkipRef(out refKind);
return lambdaBodyBinder.BindLambdaExpressionAsBlock(refKind, body, diagnostics);
return lambdaBodyBinder.BindLambdaExpressionAsBlock((ExpressionSyntax)this.Body, diagnostics);
}
else
{
Expand Down
18 changes: 0 additions & 18 deletions src/Compilers/CSharp/Portable/CSharpResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4806,12 +4806,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>
Expand Down
59 changes: 25 additions & 34 deletions src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,44 +1391,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 = 8194, 8195
// Available = 8179-8195

#region diagnostics for out var
ERR_ImplicitlyTypedOutVariableUsedInTheSameArgumentList = 8196,
Expand Down
25 changes: 21 additions & 4 deletions src/Compilers/CSharp/Portable/Symbols/Source/SourceLocalSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ public static SourceLocalSymbol MakeLocal(
return new LocalWithInitializer(containingSymbol, binder, typeSyntax, identifierToken, initializer, declarationKind);
}

/// <param name="containingSymbol"></param>
/// <param name="scopeBinder">
/// Binder that owns the scope for the local, the one that returns it in its <see cref="Binder.Locals"/> array.
/// </param>
/// <param name="enclosingBinderOpt">
/// Enclosing binder for the location where the local is declared, if different from the <paramref name="scopeBinder"/>.
/// It should be used to bind something at that location.
/// </param>
/// <param name="typeSyntax"></param>
/// <param name="identifierToken"></param>
/// <param name="context"></param>
public static SourceLocalSymbol MakeOutVariable(
Symbol containingSymbol,
Binder scopeBinder,
Expand All @@ -129,7 +140,12 @@ public static SourceLocalSymbol MakeOutVariable(
SyntaxToken identifierToken,
CSharpSyntaxNode context)
{
return new OutLocalSymbol(containingSymbol, scopeBinder, enclosingBinderOpt, typeSyntax, identifierToken, context);
if (typeSyntax.IsVar)
{
return new PossiblyImplicitlyTypedOutVarLocalSymbol(containingSymbol, scopeBinder, enclosingBinderOpt, typeSyntax, identifierToken, context);
}

return new SourceLocalSymbol(containingSymbol, scopeBinder, false, typeSyntax, identifierToken, LocalDeclarationKind.RegularVariable);
}

internal override bool IsImportedFromMetadata
Expand Down Expand Up @@ -581,14 +597,15 @@ protected override TypeSymbol InferTypeOfVarVariable(DiagnosticBag diagnostics)
}

/// <summary>
/// Symbol for an out variable local.
/// Symbol for an out variable local that might require type inference during overload resolution, i.e.
/// its type is syntactically 'var'.
/// </summary>
private class OutLocalSymbol : SourceLocalSymbol
private class PossiblyImplicitlyTypedOutVarLocalSymbol : SourceLocalSymbol
{
private readonly CSharpSyntaxNode _containingInvocation;
private readonly Binder _enclosingBinderOpt;

public OutLocalSymbol(
public PossiblyImplicitlyTypedOutVarLocalSymbol(
Symbol containingSymbol,
Binder scopeBinder,
Binder enclosingBinderOpt,
Expand Down
Loading

0 comments on commit c5d42df

Please sign in to comment.