Relax cascade_invocations lint for assignments? #57944
Labels
devexp-linter
Issues with the analyzer's support for the linter package
legacy-area-analyzer
Use area-devexp instead.
linter-false-positive
I had some code:
I have the
cascade_invocations
lint enabled because using the cascade operator still doesn't quite come naturally to me. The lint suggested changing it to:However, using the cascade operator here changes the order of operations, and it led to a bug where the callback fired synchronously and failed assertions because
_imageStream
had not yet been set tonewImageStream
.Perhaps the
cascade_invocations
lint should be relaxed if the expression is being used as the RHS of an assignment? (Or possibly if the cascaded expression would be the RHS of an assignment and if we can somehow determine that the expression is doing something non-trivial that could depend on the LHS of the assignment.)(I suppose something else to consider is whether
foo = bar..baz()
could be treated as(foo = bar)..baz()
instead of asfoo = (bar..baz)
, but I admit that that probably would be unexpected, particularly if the cascaded expression all fits on one line.)The text was updated successfully, but these errors were encountered: