From 830fc0f4531512e3c3e170bc4ce8a8e84942b141 Mon Sep 17 00:00:00 2001 From: pca006132 Date: Fri, 8 Apr 2022 23:46:22 +0800 Subject: [PATCH] escape analysis: make list elements imprecise --- nac3core/src/typecheck/escape_analysis/lifetime.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nac3core/src/typecheck/escape_analysis/lifetime.rs b/nac3core/src/typecheck/escape_analysis/lifetime.rs index b71bdc95f..5f30f0389 100644 --- a/nac3core/src/typecheck/escape_analysis/lifetime.rs +++ b/nac3core/src/typecheck/escape_analysis/lifetime.rs @@ -396,6 +396,13 @@ impl<'a> LifetimeAnalyzer<'a> { // unify with unknown lifetime self.unify(LifetimeId(0), field_lifetime); } + if field == "$elem".into() { + let field_lifetime_id = *self.lifetime_to_id.get(&field_lifetime).unwrap(); + let field_lifetime = self.lifetime_stores.get_mut(field_lifetime_id).unwrap(); + if field_lifetime.kind == PreciseLocal { + field_lifetime.to_mut().kind = ImpreciseLocal; + } + } } } _ => (),