Skip to content

Commit

Permalink
Merge remote-tracking branch 'dotnet/master' into declarator-ignored-arg
Browse files Browse the repository at this point in the history
* dotnet/master: (28 commits)
  Fix the operation verifier code now that getoperationinternal no longer exists.
  Remove usage of IOperation feature flag in newly added unit tests
  More fixes for IOperation tree. (dotnet#23028)
  Address PR feedback and remove unused resource and comment out unused error code
  Remove IOperation feature flag and internal registration APIs for operations
  Add unit test for VB
  Address review feedback and add more unit tests
  Fix unit tests
  Fix build errors from merge resolution
  Revert unintentional newline deletion
  Address recent feedback and do not generate an IParenthesizedOperation for C#. This change is now just a test-only change that verifies the current behavior.
  Address PR feedback and use singleton for null instance
  Address PR feedback
  Address PR feedback
  Do not invoke GetStandaloneNode helper in GetOperationWorker
  Fix InvalidCastException in CSharpOperationFactory for invalid nested member initializer (dotnet#22983)
  Use ICollection<string>.Contains to avoid Enumerator allocation
  Add IsRef property to IConditionalOperation and ISimpleAssignmentOperation, add RefKind property to ILocalSymbol. (dotnet#22933)
  Enable peverify-compat mode for langver < 7.2 (dotnet#22772)
  Fix IArgument and IArrayInitializer to have null types
  ...
  • Loading branch information
333fred committed Nov 9, 2017
2 parents 13a6f43 + c650332 commit 22d6255
Show file tree
Hide file tree
Showing 149 changed files with 3,674 additions and 1,899 deletions.
11 changes: 1 addition & 10 deletions src/Compilers/CSharp/Portable/Binder/Binder.ValueChecks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,7 @@ private BoundExpression CheckValue(BoundExpression expr, BindValueKind valueKind
var indexerAccess = (BoundIndexerAccess)expr;
if (valueKind == BindValueKind.Assignable && !indexerAccess.Indexer.ReturnsByRef)
{
expr = indexerAccess.Update(indexerAccess.ReceiverOpt,
indexerAccess.Indexer,
indexerAccess.Arguments,
indexerAccess.ArgumentNamesOpt,
indexerAccess.ArgumentRefKindsOpt,
indexerAccess.Expanded,
indexerAccess.ArgsToParamsOpt,
indexerAccess.BinderOpt,
useSetterForDefaultArgumentGeneration: true,
type: indexerAccess.Type);
expr = indexerAccess.Update(useSetterForDefaultArgumentGeneration: true);
}
}
break;
Expand Down
10 changes: 3 additions & 7 deletions src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6535,7 +6535,8 @@ private BoundExpression BindPointerElementAccess(ExpressionSyntax node, BoundExp
{
Error(diagnostics, ErrorCode.ERR_PtrIndexSingle, node);
}
return new BoundPointerElementAccess(node, expr, BadExpression(node, BuildArgumentsForErrorRecovery(analyzedArguments)), CheckOverflowAtRuntime, pointedAtType, hasErrors: true);
return new BoundPointerElementAccess(node, expr, BadExpression(node, BuildArgumentsForErrorRecovery(analyzedArguments)).MakeCompilerGenerated(),
CheckOverflowAtRuntime, pointedAtType, hasErrors: true);
}

if (pointedAtType.SpecialType == SpecialType.System_Void)
Expand Down Expand Up @@ -7192,19 +7193,14 @@ private BoundExpression GetReceiverForConditionalBinding(ExpressionSyntax bindin
receiver = BindConditionalAccessReceiver(conditionalAccessNode, diagnostics);
}

if (receiver.HasAnyErrors)
{
return receiver;
}

// create surrogate receiver
var receiverType = receiver.Type;
if (receiverType?.IsNullableType() == true)
{
receiverType = receiverType.GetNullableUnderlyingType();
}

receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType) { WasCompilerGenerated = true };
receiver = new BoundConditionalReceiver(receiver.Syntax, 0, receiverType ?? CreateErrorType(), hasErrors: receiver.HasErrors) { WasCompilerGenerated = true };
return receiver;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,7 @@ private bool IsOperandErrors(CSharpSyntaxNode node, ref BoundExpression operand,
if (!operand.HasAnyErrors)
{
Error(diagnostics, ErrorCode.ERR_LambdaInIsAs, node);
operand = BadExpression(node, operand);
operand = BadExpression(node, operand).MakeCompilerGenerated();
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private BoundStatement BindYieldReturnStatement(YieldStatementSyntax node, Diagn

TypeSymbol elementType = binder.GetIteratorElementType(node, diagnostics);
BoundExpression argument = (node.Expression == null)
? BadExpression(node)
? BadExpression(node).MakeCompilerGenerated()
: binder.BindValue(node.Expression, diagnostics, BindValueKind.RValue);
argument = ValidateEscape(argument, ExternalScope, isByRef: false, diagnostics: diagnostics);

Expand Down
6 changes: 0 additions & 6 deletions src/Compilers/CSharp/Portable/Binder/Binder_Symbols.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2113,12 +2113,6 @@ private static CSDiagnosticInfo GetFeatureAvailabilityDiagnosticInfo(SyntaxTree
return null;
}

string requiredFeature = feature.RequiredFeature();
if (requiredFeature != null)
{
return new CSDiagnosticInfo(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature);
}

LanguageVersion availableVersion = options.LanguageVersion;
LanguageVersion requiredVersion = feature.RequiredVersion();
if (requiredVersion > availableVersion)
Expand Down
28 changes: 28 additions & 0 deletions src/Compilers/CSharp/Portable/BoundTree/BoundExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,34 @@ public override Symbol ExpressionSymbol
// DevDiv 1087283 tracks deciding whether or not to refactor this into BoundNodes.xml.
public ImmutableArray<PropertySymbol> OriginalIndexersOpt { get; private set; }

public BoundIndexerAccess Update(bool useSetterForDefaultArgumentGeneration)
{
if (useSetterForDefaultArgumentGeneration != this.UseSetterForDefaultArgumentGeneration)
{
var result = new BoundIndexerAccess(
this.Syntax,
this.ReceiverOpt,
this.Indexer,
this.Arguments,
this.ArgumentNamesOpt,
this.ArgumentRefKindsOpt,
this.Expanded,
this.ArgsToParamsOpt,
this.BinderOpt,
useSetterForDefaultArgumentGeneration,
this.Type,
this.HasErrors)
{
WasCompilerGenerated = this.WasCompilerGenerated,
OriginalIndexersOpt = this.OriginalIndexersOpt
};

return result;
}

return this;
}

public override LookupResultKind ResultKind
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@ public static bool IsConstructorInitializer(this BoundCall call)
receiverOpt != null &&
(receiverOpt.Kind == BoundKind.ThisReference || receiverOpt.Kind == BoundKind.BaseReference);
}

public static T MakeCompilerGenerated<T>(this T node) where T : BoundNode
{
node.WasCompilerGenerated = true;
return node;
}
}
}
5 changes: 0 additions & 5 deletions src/Compilers/CSharp/Portable/CSharpParseOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@ internal override void ValidateOptions(ArrayBuilder<Diagnostic> builder)

internal bool IsFeatureEnabled(MessageID feature)
{
string featureFlag = feature.RequiredFeature();
if (featureFlag != null)
{
return Features.ContainsKey(featureFlag);
}
LanguageVersion availableVersion = LanguageVersion;
LanguageVersion requiredVersion = feature.RequiredVersion();
return availableVersion >= requiredVersion;
Expand Down
9 changes: 0 additions & 9 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.

3 changes: 0 additions & 3 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4401,9 +4401,6 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_FeatureNotAvailableInVersion7" xml:space="preserve">
<value>Feature '{0}' is not available in C# 7.0. Please use language version {1} or greater.</value>
</data>
<data name="ERR_FeatureIsExperimental" xml:space="preserve">
<value>Feature '{0}' is experimental and unsupported; use '/features:{1}' to enable.</value>
</data>
<data name="ERR_FeatureIsUnimplemented" xml:space="preserve">
<value>Feature '{0}' is not implemented in this compiler.</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/CodeGen/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private bool IsDebugPlus()

private bool EnablePEVerifyCompat()
{
return _module.Compilation.FeaturePEVerifyCompatEnabled;
return _module.Compilation.LanguageVersion < LanguageVersion.CSharp7_2 || _module.Compilation.FeaturePEVerifyCompatEnabled;
}

private LocalDefinition LazyReturnTemp
Expand Down
Loading

0 comments on commit 22d6255

Please sign in to comment.