d022d4c9e1
Fixes https://github.com/dart-lang/sdk/issues/42375 EdgeBuilder wishes to do its own GLB type-joining, as does FlowAnalysis. When FlowAnalysis pushes a promotion in ifNullExpression_rightBegin, and then in write, and then pops those two promotions to join them in ifNullExpression_end, EdgeBuilder is not given a chance to make its own GLB node. Instead promotion never happens: the DecoratedType which is the variable's type is promoted to non-nullable, for the left side. The DecoratedType for the right side expression is not considered non-nullable, so the FlowAnalysis.join will always fail to promote. TypeOperations.adjustPromotedTypes solves this. It is a no-op in all implementations except in EdgeBuilder. Additionally FlowAnalysis.write's promotion fails for the same reason: the only type of interest is the declared type made non-nullable, and no matter what, the writtenType is not a subtype of this. TypeOperations.forcePromotion solves this. It is a no-op in all implementations except EdgeBuilder. Change-Id: Iba6b9a69583af8fe1aa23124c7d66047acfff495 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152104 Reviewed-by: Paul Berry <paulberry@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
FE/analyzer shared code
This package contains logic that is shared between the front_end and analyzer packages. It is intended solely to facilitate development of the Dart SDK, and is not intended for use by end users. In particular, this package has no public API, so no guarantee is made of compatibility between one version of the package and the next.
End users should consider using the analyzer package to analyze Dart source code.