From d00a2a5ede3f454774d5b6e101f1314c9edb8856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C5=9Bkowicz?= Date: Fri, 22 Dec 2023 12:06:10 +0100 Subject: [PATCH] Add support for compiler experimental features in `snforge-test-collector` commit-id:774bde45 revert previous commit update snforge-test-collector remove unused method review update - forge test collector --- .../src/metadata.rs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/extensions/scarb-snforge-test-collector/src/metadata.rs b/extensions/scarb-snforge-test-collector/src/metadata.rs index edd8c1590..d863154a0 100644 --- a/extensions/scarb-snforge-test-collector/src/metadata.rs +++ b/extensions/scarb-snforge-test-collector/src/metadata.rs @@ -1,5 +1,5 @@ use anyhow::{anyhow, ensure, Context, Result}; -use cairo_lang_filesystem::db::{CrateSettings, Edition}; +use cairo_lang_filesystem::db::{CrateSettings, Edition, ExperimentalFeaturesConfig}; use cairo_lang_project::AllCratesConfig; use cairo_lang_utils::ordered_hash_map::OrderedHashMap; use camino::{Utf8Path, Utf8PathBuf}; @@ -109,24 +109,25 @@ impl CompilationUnit<'_> { .components .iter() .map(|component| { + let pkg = self + .metadata + .get_package(&component.package) + .unwrap_or_else(|| panic!("Failed to find = {} package", &component.package)); ( SmolStr::from(&component.name), CrateSettings { - edition: if let Some(edition) = self - .metadata - .get_package(&component.package) - .unwrap_or_else(|| { - panic!("Failed to find = {} package", component.package) - }) - .edition - .clone() - { + edition: if let Some(edition) = pkg.edition.clone() { let edition_value = serde_json::Value::String(edition); serde_json::from_value(edition_value).unwrap() } else { Edition::default() }, - experimental_features: Default::default(), + // TODO (#1040): replace this with a macro + experimental_features: ExperimentalFeaturesConfig { + negative_impls: pkg + .experimental_features + .contains(&String::from("negative_impls")), + }, }, ) })