-
-
Notifications
You must be signed in to change notification settings - Fork 1k
chore: Enable nullable annotation for validators #2902
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
base: master
Are you sure you want to change the base?
Conversation
| // to have backward compatibility for people who implemented IValidator(Benchmark[] benchmarks) | ||
| public static implicit operator ValidationParameters(BenchmarkCase[] benchmarksCase) => new ValidationParameters(benchmarksCase, null); | ||
| public static implicit operator ValidationParameters(BenchmarkRunInfo benchmarkRunInfo) => new ValidationParameters(benchmarkRunInfo.BenchmarksCases, null); | ||
| // Note: Following implicit operators are expected to be used for test projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove backward compatibility comments.
Because when null is passed to config parameter.
It'll throw NullReferenceException when accessing config property.
These implicit operators seems to be used for test projects.
e0b5671 to
8f4bfa3
Compare
|
Please re-run |
| public IReadOnlyList<BenchmarkCase> Benchmarks { get; } | ||
|
|
||
| public ImmutableConfig? Config { get; } | ||
| public ImmutableConfig Config { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand why this is changed from nullable when null is explicitly passed in the implicit operators. We should just remove those operators if they are no longer useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just remove those operators if they are no longer useful.
I think that's the correct way to fix it.
Though when removing these implicit operators. It cause about 39 build errors on test projects. and without implicit operators.
It need to add a lot of additional code. (e.g. Create ToValidationParameters extension method and call this method on every location that using implicit operators)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about changing null to DefaultConfig.Instance.CreateImmutableConfig() for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've modified code to use DefaultConfig.Instance.CreateImmutableConfig() on implicit operators that accept BenchmarkCase[] benchmarksCase as parameter.
And use actual config when accept (BenchmarkRunInfo benchmarkRunInfo) as parameter.
In anyway, this config is not be referenced by existing unit tests/integration tests.
5bacc38 to
d5020ae
Compare
This PR intended to fix a part issue #2815