Skip to content

Commit 4c51386

Browse files
authored
feat: fixed intersection of focus skip and filters (#327)
* feat: fixed intersection of focus skip and filters * feat: removed redudant field
1 parent 763a6dd commit 4c51386

File tree

1 file changed

+21
-31
lines changed

1 file changed

+21
-31
lines changed

crates/move-stackless-bytecode/src/function_target_pipeline.rs

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ pub struct FunctionTargetsHolder {
5252
targets: BTreeMap<QualifiedId<FunId>, BTreeMap<FunctionVariant, FunctionData>>,
5353
function_specs: BiBTreeMap<QualifiedId<FunId>, QualifiedId<FunId>>,
5454
no_verify_specs: BTreeSet<QualifiedId<FunId>>,
55-
no_focus_specs: BTreeSet<QualifiedId<FunId>>,
5655
omit_opaque_specs: BTreeSet<QualifiedId<FunId>>,
5756
skip_specs: BTreeMap<QualifiedId<FunId>, String>,
5857
focus_specs: BTreeSet<QualifiedId<FunId>>,
@@ -207,7 +206,6 @@ impl FunctionTargetsHolder {
207206
targets: BTreeMap::new(),
208207
function_specs: BiBTreeMap::new(),
209208
no_verify_specs: BTreeSet::new(),
210-
no_focus_specs: BTreeSet::new(),
211209
omit_opaque_specs: BTreeSet::new(),
212210
skip_specs: BTreeMap::new(),
213211
focus_specs: BTreeSet::new(),
@@ -294,18 +292,14 @@ impl FunctionTargetsHolder {
294292
self.function_specs.get_by_right(id)
295293
}
296294

297-
pub fn no_verify_specs(&self) -> &BTreeSet<QualifiedId<FunId>> {
295+
pub fn no_verify_specs(&self) -> Box<dyn Iterator<Item = &QualifiedId<FunId>> + '_> {
298296
if self.focus_specs.is_empty() {
299-
&self.no_verify_specs
297+
Box::new(self.no_verify_specs.iter())
300298
} else {
301-
&self.no_focus_specs
299+
Box::new(self.specs().filter(|s| !self.focus_specs.contains(s)))
302300
}
303301
}
304302

305-
pub fn no_focus_specs(&self) -> &BTreeSet<QualifiedId<FunId>> {
306-
&self.no_focus_specs
307-
}
308-
309303
pub fn focus_specs(&self) -> &BTreeSet<QualifiedId<FunId>> {
310304
&self.focus_specs
311305
}
@@ -346,10 +340,6 @@ impl FunctionTargetsHolder {
346340
self.is_spec(id) && !self.no_verify_specs().contains(id)
347341
}
348342

349-
pub fn is_focus_spec(&self, id: &QualifiedId<FunId>) -> bool {
350-
self.is_spec(id) && !self.no_focus_specs.contains(id)
351-
}
352-
353343
pub fn is_scenario_spec(&self, id: &QualifiedId<FunId>) -> bool {
354344
self.scenario_specs.contains(id)
355345
}
@@ -377,7 +367,7 @@ impl FunctionTargetsHolder {
377367
}
378368

379369
pub fn verify_specs_count(&self) -> usize {
380-
self.function_specs.len() + self.scenario_specs.len() - self.no_verify_specs().len()
370+
self.function_specs.len() + self.scenario_specs.len() - self.no_verify_specs().count()
381371
}
382372

383373
pub fn abort_checks_count(&self) -> usize {
@@ -519,26 +509,26 @@ impl FunctionTargetsHolder {
519509
.insert(func_env.get_qualified_id(), skip.clone().unwrap());
520510
}
521511

522-
if (!*prove && !*focus) || skip.is_some() || !targeted {
523-
self.no_verify_specs.insert(func_env.get_qualified_id());
512+
if *ignore_abort {
513+
self.ignore_aborts.insert(func_env.get_qualified_id());
524514
}
525515

526-
if *focus {
527-
if self.prover_options.ci {
528-
func_env.module_env.env.diag(
529-
Severity::Error,
530-
&func_env.get_loc(),
531-
"The 'focus' attribute is restricted in CI mode.",
532-
);
533-
return;
534-
}
535-
self.focus_specs.insert(func_env.get_qualified_id());
516+
if skip.is_some() || !targeted {
517+
self.no_verify_specs.insert(func_env.get_qualified_id());
536518
} else {
537-
self.no_focus_specs.insert(func_env.get_qualified_id());
538-
}
539-
540-
if *ignore_abort {
541-
self.ignore_aborts.insert(func_env.get_qualified_id());
519+
if *focus {
520+
if self.prover_options.ci {
521+
func_env.module_env.env.diag(
522+
Severity::Error,
523+
&func_env.get_loc(),
524+
"The 'focus' attribute is restricted in CI mode.",
525+
);
526+
return;
527+
}
528+
self.focus_specs.insert(func_env.get_qualified_id());
529+
} else if !*prove {
530+
self.no_verify_specs.insert(func_env.get_qualified_id());
531+
}
542532
}
543533

544534
if target.is_some() {

0 commit comments

Comments
 (0)