Do not treat Expr::Index with pure index as pure.

This commit is contained in:
Stephen Chung 2021-04-24 13:42:30 +08:00
parent 61b559a58f
commit b5a2937336
2 changed files with 2 additions and 3 deletions

View File

@ -10,6 +10,7 @@ Bug fixes
---------
* Fixed bug when position is zero in `insert` and `split_at` methods for arrays.
* Indexing operations with pure index values are no longer considered pure due to the possibility of indexers.
Breaking changes
----------------

View File

@ -1899,9 +1899,7 @@ impl Expr {
Self::Map(x, _) => x.0.iter().map(|(_, v)| v).all(Self::is_pure),
Self::Index(x, _) | Self::And(x, _) | Self::Or(x, _) => {
x.lhs.is_pure() && x.rhs.is_pure()
}
Self::And(x, _) | Self::Or(x, _) => x.lhs.is_pure() && x.rhs.is_pure(),
Self::Stmt(x) => x.0.iter().all(Stmt::is_pure),