Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into enable-tests
Browse files Browse the repository at this point in the history
* upstream/master:
  For the purpose of runtime capability check require RuntimeFeature type to be a static class. (dotnet#50829)
  Allow mixed declaration and assignment in deconstruction (dotnet#44476)
  Disable sdl
  Fix crash around handling delegating of constructors cross-project
  Clarify in a comment when some stuff loads
  Don't reference the implementation type directly if we don't need it
  Remove the CreateWorkspace() method that implies it's created there
  Delete AbstractPackage`2.IsInIdeMode()
  Remove some very outdated comments
  • Loading branch information
333fred committed Jan 28, 2021
2 parents d8000fb + d525bcf commit f494d72
Show file tree
Hide file tree
Showing 38 changed files with 1,617 additions and 241 deletions.
3 changes: 2 additions & 1 deletion azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ stages:
- SetValidateDependency
# Enable SDL validation, passing through values from the 'DotNet-Roslyn-SDLValidation-Params' group.
SDLValidationParameters:
enable: true
# Disable SDL because of https://github.com/dotnet/core-eng/issues/11902
enable: false
params: >-
-SourceToolsList @("policheck","credscan")
-TsaInstanceURL $(_TsaInstanceURL)
Expand Down
9 changes: 4 additions & 5 deletions src/Compilers/CSharp/Portable/Binder/Binder_Deconstruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,17 @@ internal BoundExpression BindDeconstruction(AssignmentExpressionSyntax node, Dia
case SyntaxKind.ExpressionStatement:
if (expression != null)
{
// We only allow assignment-only or declaration-only deconstructions at this point.
// Issue https://github.com/dotnet/roslyn/issues/15050 tracks allowing mixed deconstructions.
// For now we give an error when you mix.
Error(diagnostics, ErrorCode.ERR_MixedDeconstructionUnsupported, left);
MessageID.IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction
.CheckFeatureAvailability(diagnostics, Compilation, node.Location);
}
break;
case SyntaxKind.ForStatement:
if (((ForStatementSyntax)node.Parent).Initializers.Contains(node))
{
if (expression != null)
{
Error(diagnostics, ErrorCode.ERR_MixedDeconstructionUnsupported, left);
MessageID.IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction
.CheckFeatureAvailability(diagnostics, Compilation, node.Location);
}
}
else
Expand Down
6 changes: 3 additions & 3 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -5293,9 +5293,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_ThrowMisplaced" xml:space="preserve">
<value>A throw expression is not allowed in this context.</value>
</data>
<data name="ERR_MixedDeconstructionUnsupported" xml:space="preserve">
<value>A deconstruction cannot mix declarations and expressions on the left-hand-side.</value>
</data>
<data name="ERR_DeclarationExpressionNotPermitted" xml:space="preserve">
<value>A declaration is not allowed in this context.</value>
</data>
Expand Down Expand Up @@ -6566,6 +6563,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="IDS_FeatureDiscards" xml:space="preserve">
<value>discards</value>
</data>
<data name="IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction" xml:space="preserve">
<value>Mixed declarations and expressions in deconstruction</value>
</data>
<data name="IDS_FeatureVarianceSafetyForStaticInterfaceMembers" xml:space="preserve">
<value>variance safety for static interface members</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ internal enum ErrorCode
ERR_NewWithTupleTypeSyntax = 8181,
ERR_PredefinedValueTupleTypeMustBeStruct = 8182,
ERR_DiscardTypeInferenceFailed = 8183,
ERR_MixedDeconstructionUnsupported = 8184,
// ERR_MixedDeconstructionUnsupported = 8184,
ERR_DeclarationExpressionNotPermitted = 8185,
ERR_MustDeclareForeachIteration = 8186,
ERR_TupleElementNamesInDeconstruction = 8187,
Expand Down
4 changes: 4 additions & 0 deletions src/Compilers/CSharp/Portable/Errors/MessageID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ internal enum MessageID
IDS_Return = MessageBase + 12790,
IDS_FeatureVarianceSafetyForStaticInterfaceMembers = MessageBase + 12791,
IDS_FeatureConstantInterpolatedStrings = MessageBase + 12792,
IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction = MessageBase + 12793,
}

// Message IDs may refer to strings that need to be localized.
Expand Down Expand Up @@ -321,6 +322,9 @@ internal static LanguageVersion RequiredVersion(this MessageID feature)
// Checks are in the LanguageParser unless otherwise noted.
switch (feature)
{
// C# preview features.
case MessageID.IDS_FeatureMixedDeclarationsAndExpressionsInDeconstruction:
return LanguageVersion.Preview;
// C# 9.0 features.
case MessageID.IDS_FeatureLambdaDiscardParameters: // semantic check
case MessageID.IDS_FeatureFunctionPointers:
Expand Down
13 changes: 10 additions & 3 deletions src/Compilers/CSharp/Portable/Symbols/AssemblySymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,18 @@ internal virtual NamedTypeSymbol GetNativeIntegerType(NamedTypeSymbol underlying
/// </summary>
internal bool RuntimeSupportsDefaultInterfaceImplementation
{
get => GetSpecialTypeMember(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__DefaultImplementationsOfInterfaces) is object;
get => RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__DefaultImplementationsOfInterfaces);
}

private bool RuntimeSupportsFeature(SpecialMember feature)
{
Debug.Assert((SpecialType)SpecialMembers.GetDescriptor(feature).DeclaringTypeId == SpecialType.System_Runtime_CompilerServices_RuntimeFeature);
return GetSpecialType(SpecialType.System_Runtime_CompilerServices_RuntimeFeature) is { TypeKind: TypeKind.Class, IsStatic: true } &&
GetSpecialTypeMember(feature) is object;
}

internal bool RuntimeSupportsUnmanagedSignatureCallingConvention
=> GetSpecialTypeMember(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__UnmanagedSignatureCallingConvention) is object;
=> RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__UnmanagedSignatureCallingConvention);

/// <summary>
/// True if the target runtime support covariant returns of methods declared in classes.
Expand All @@ -441,7 +448,7 @@ internal bool RuntimeSupportsCovariantReturnsOfClasses
{
// check for the runtime feature indicator and the required attribute.
return
GetSpecialTypeMember(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__CovariantReturnsOfClasses) is { } &&
RuntimeSupportsFeature(SpecialMember.System_Runtime_CompilerServices_RuntimeFeature__CovariantReturnsOfClasses) &&
GetSpecialType(SpecialType.System_Runtime_CompilerServices_PreserveBaseOverridesAttribute) is { TypeKind: TypeKind.Class };
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf

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

10 changes: 5 additions & 5 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf

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

Loading

0 comments on commit f494d72

Please sign in to comment.