This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Add tests for invalid inputs to Expression.New#10952
Merged
stephentoub merged 3 commits intodotnet:masterfrom Aug 19, 2016
hughbe:new-expression-tests
Merged
Add tests for invalid inputs to Expression.New#10952stephentoub merged 3 commits intodotnet:masterfrom hughbe:new-expression-tests
stephentoub merged 3 commits intodotnet:masterfrom
hughbe:new-expression-tests
Conversation
Also adds some param names that were brought up from these tests
| Expression arg = arguments[i]; | ||
| ParameterInfo pi = pis[i]; | ||
| arg = ValidateOneArgument(method, nodeKind, arg, pi); | ||
| arg = ValidateOneArgument(method, nodeKind, arg, pi, methodParamName, $"{nameof(arguments)}[{i}]"); |
Contributor
There was a problem hiding this comment.
Quite some additional string allocations here. I'd stick with a constant string, if any at all.
Author
There was a problem hiding this comment.
Good point. I'm not sure how large the perf impact is, but maybe just a nameof() is good. I do think that it is important to have the param name, however.
Member
There was a problem hiding this comment.
nameof() is cheap, as it's just a const string in the compiled IL. String interpolation involves a String.Format call and associated allocations/work.
Author
|
Thanks for the |
Member
|
LGTM. Thanks, Hugh. |
picenka21
pushed a commit
to picenka21/runtime
that referenced
this pull request
Feb 18, 2022
* Add tests for invalid inputs to Expression.New Also adds some param names that were brought up from these tests Commit migrated from dotnet/corefx@c91aa58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also adds some param names that were brought up from these tests
Contributes to #1198 (~1% increase in CC)
/cc @stephentoub @VSadov