Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IInvocationExpression and IArgument refinement and testing #11450

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
95eed9f
Beginning work on serious IOperation testing.
msJohnHamby Apr 20, 2016
f09e703
More testing.
msJohnHamby Apr 21, 2016
22f4439
More testing.
msJohnHamby Apr 21, 2016
f8fcd33
Progress on testing IInvocationExpression and IArgument.
msJohnHamby Apr 22, 2016
8be60e4
Rename IInvocationExpression.ArgumentsInSourceOrder to ArgumentsInEva…
msJohnHamby Apr 22, 2016
8b915a8
Renamed a test class.
msJohnHamby Apr 22, 2016
ed039e1
Finished renaming the test class.
msJohnHamby Apr 22, 2016
e089f4e
Added a delegate invocation test.
msJohnHamby Apr 22, 2016
c15bc77
More.
msJohnHamby Apr 23, 2016
da75981
Merge remote-tracking branch 'upstream/master' into IOperationRescue
msJohnHamby May 9, 2016
b6e3d29
More
msJohnHamby May 10, 2016
dcb51b2
Merge remote-tracking branch 'upstream/master' into IOperationRescue
msJohnHamby May 17, 2016
4f358d6
Removed ArgumentKind from IArgument.
msJohnHamby May 18, 2016
6843108
Progress on VB tests.
msJohnHamby May 19, 2016
297466f
Made virtual invocations test work for VB.
msJohnHamby May 19, 2016
a340980
Added more VB tests.
msJohnHamby May 19, 2016
f0805f9
Viable unit of C# and VB tests.
msJohnHamby May 20, 2016
4e5617e
Moved ArgumentsInEvaluationOrder from IInvocationExpression to IHasAr…
msJohnHamby May 20, 2016
4a94d83
Removed ArgumentBase class.
msJohnHamby May 20, 2016
dc65eaf
Partial responses to review feedback. Not ready for further review.
msJohnHamby May 24, 2016
375839d
Merge remote-tracking branch 'upstream/features/ioperation' into IOpe…
msJohnHamby May 25, 2016
8a72012
Employ helper methods to make tests smaller and easier to understand.
msJohnHamby Jun 2, 2016
5e97607
Review feedback now addressed, except for the issue of trying to use …
msJohnHamby Jun 3, 2016
b1c39ce
Beginning work to leverate LocalRewriter in argument processing.
msJohnHamby Jun 6, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/Rulesets/Roslyn_BuildRules.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<Rule Id="CA1308" Action="None" />
<Rule Id="CA1810" Action="None" />
<Rule Id="CA1816" Action="None" />
<Rule Id="CA1825" Action="Warning" />
<Rule Id="CA1825" Action="None" />
<Rule Id="CA2002" Action="None" />
<Rule Id="CA2207" Action="None" />
<Rule Id="CA2208" Action="None" />
Expand Down
220 changes: 116 additions & 104 deletions src/Compilers/CSharp/Portable/BoundTree/Expression.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,28 @@ internal sealed partial class LocalRewriter : BoundTreeRewriterWithStackGuard
private bool _sawAwait;
private bool _sawAwaitInExceptionHandler;
private readonly DiagnosticBag _diagnostics;
private readonly bool _inIOperationContext;

private LocalRewriter(
internal LocalRewriter(
CSharpCompilation compilation,
MethodSymbol containingMethod,
int containingMethodOrdinal,
NamedTypeSymbol containingType,
SyntheticBoundNodeFactory factory,
SynthesizedSubmissionFields previousSubmissionFields,
bool allowOmissionOfConditionalCalls,
DiagnosticBag diagnostics)
DiagnosticBag diagnostics,
bool inIOperationContext = false)
{
_compilation = compilation;
_factory = factory;
_factory.CurrentMethod = containingMethod;
Debug.Assert(factory.CurrentType == (containingType ?? containingMethod.ContainingType));
Debug.Assert(factory.CurrentType == (containingType ?? containingMethod?.ContainingType));
_dynamicFactory = new LoweredDynamicOperationFactory(factory, containingMethodOrdinal);
_previousSubmissionFields = previousSubmissionFields;
_allowOmissionOfConditionalCalls = allowOmissionOfConditionalCalls;
_diagnostics = diagnostics;
_inIOperationContext = inIOperationContext;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private static bool IsSafeForReordering(BoundExpression expression, RefKind kind
/// itself. <paramref name="optionalParametersMethod"/> is needed for indexers since getter and setter
/// may have distinct optional parameter values.
/// </summary>
private ImmutableArray<BoundExpression> MakeArguments(
internal ImmutableArray<BoundExpression> MakeArguments(
CSharpSyntaxNode syntax,
ImmutableArray<BoundExpression> rewrittenArguments,
Symbol methodOrIndexer,
Expand Down Expand Up @@ -621,7 +621,7 @@ private BoundExpression BuildParamsArray(
// if it's available. However, we also disable the optimization if we're in an expression lambda, the
// point of which is just to represent the semantics of an operation, and we don't know that all consumers
// of expression lambdas will appropriately understand Array.Empty<T>().
if (arrayArgs.Length == 0 && !_inExpressionLambda)
if (arrayArgs.Length == 0 && !_inExpressionLambda && !_inIOperationContext)
{
ArrayTypeSymbol ats = paramArrayType as ArrayTypeSymbol;
if (ats != null) // could be null if there's a semantic error, e.g. the params parameter type isn't an array
Expand Down Expand Up @@ -797,8 +797,8 @@ private void InsertMissingOptionalArguments(CSharpSyntaxNode syntax,
if (arguments[p] == null)
{
ParameterSymbol parameter = parameters[p];
Debug.Assert(parameter.IsOptional);
arguments[p] = GetDefaultParameterValue(syntax, parameter, enableCallerInfo);
Debug.Assert(parameter.IsOptional || _inIOperationContext);
arguments[p] = parameter.IsOptional ? GetDefaultParameterValue(syntax, parameter, enableCallerInfo) : new BoundBadExpression(syntax, LookupResultKind.Empty, ImmutableArray<Symbol>.Empty, ImmutableArray<BoundNode>.Empty, parameter.Type);
Debug.Assert(arguments[p].Type == parameter.Type);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,17 @@ public SyntheticBoundNodeFactory(MethodSymbol topLevelMethodOpt, NamedTypeSymbol
this.Diagnostics = diagnostics;
}

/// <summary>
/// Constructor used in circumstances where type/method context is not available, producing a factory of limited capability.
/// </summary>
/// <param name="node">The syntax node to which generated code should be attributed</param>
/// <param name="diagnostics">A bag where any diagnostics should be output</param>
internal SyntheticBoundNodeFactory(CSharpSyntaxNode node, DiagnosticBag diagnostics)
{
this.Syntax = node;
this.Diagnostics = diagnostics;
}

[Conditional("DEBUG")]
private void CheckCurrentType()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<Compile Include="Diagnostics\DiagnosticAnalyzerTests.AllInOne.cs" />
<Compile Include="Diagnostics\DiagnosticAnalyzerTests.cs" />
<Compile Include="Diagnostics\GetDiagnosticsTests.cs" />
<Compile Include="Diagnostics\IInvocationExpressionTests.cs" />
<Compile Include="Diagnostics\OperationAnalyzerTests.cs" />
<Compile Include="FlowAnalysis\FlowDiagnosticTests.cs" />
<Compile Include="FlowAnalysis\FlowTestBase.cs" />
Expand Down
Loading