Skip to content

Commit

Permalink
Alternative approach
Browse files Browse the repository at this point in the history
  • Loading branch information
jcouv committed Nov 1, 2024
1 parent e6796a3 commit b5969c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Portable/Binder/Binder_Conversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ private static BoundExpression ConvertObjectCreationExpression(
ConversionGroup? conversionGroupOpt, bool wasCompilerGenerated, BindingDiagnosticBag diagnostics)
{
var arguments = AnalyzedArguments.GetInstance(node.Arguments, node.ArgumentRefKindsOpt, node.ArgumentNamesOpt);
BoundExpression expr = bindObjectCreationExpression(node.Syntax, node.InitializerOpt, node.Binder, destination.StrippedType(), arguments, diagnostics);
BoundExpression expr = bindObjectCreationExpression(((ImplicitObjectCreationExpressionSyntax)node.Syntax).ArgumentList, node.InitializerOpt, node.Binder, destination.StrippedType(), arguments, diagnostics);
arguments.Free();

Debug.Assert(expr is BoundObjectCreationExpressionBase { WasTargetTyped: true } or
Expand Down
13 changes: 2 additions & 11 deletions src/Compilers/CSharp/Portable/BoundTree/BoundNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,11 @@ public bool HasAnyErrors
{
get
{
if (this.HasErrors)
// NOTE: check Syntax rather than WasCompilerGenerated because sequence points can have null syntax.
if (this.HasErrors || this.Syntax != null && this.Syntax.HasErrors)
{
return true;
}

// The syntax attached to placeholders should not limit usage of those placeholders
if (this is not BoundValuePlaceholderBase)
{
// NOTE: check Syntax rather than WasCompilerGenerated because sequence points can have null syntax.
if (this.Syntax != null && this.Syntax.HasErrors)
{
return true;
}
}
var expression = this as BoundExpression;
return expression?.Type?.IsErrorType() == true;
}
Expand Down

0 comments on commit b5969c2

Please sign in to comment.