d0278ea7b8
Adds a language test and a flow analysis unit test to cover a flow analysis behavior of post-increment and post-decrement operators that wasn't previously covered. The tests verify that the expressions `x++` and `x--` demote `x` in the same way that `x = x + 1` and `x = x - 1` would. This demotion is only user-visible if the type of `x` is a user-defined type. In the process of writing these tests, I noticed that the "mini-AST" implementation of post-increment (which is used solely for flow analysis unit testing) was not correct; it presumed that the type read from the target, the type written to it, and the type of the whole expression were all the same. This is not correct; the type written to the target is determined by the return type of the `+` operator. I've fixed this as part of this CL so that the unit test properly exercises flow analysis. I will follow this up with some refactoring of how flow analysis handles post increment/decrement operations. Landing the test first allows us to be confident that the refactor won't change the tested behavior. Change-Id: I6a6a6964417b48db0c1681c06d7418bd79e96357 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/482342 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>