@@ -2,33 +2,35 @@ use crate::profile_validation::{bool_field, bool_field_or_unstable, str_field};
22use anyhow:: ensure;
33use camino:: Utf8PathBuf ;
44use indoc:: formatdoc;
5+ use scarb_api:: version:: scarb_version;
6+ use semver:: Version ;
57use serde_json:: Value ;
68
79pub fn check_debugger_compatibility (
810 compiler_config : & Value ,
911 profile : & str ,
1012 workspace_manifest_path : & Utf8PathBuf ,
1113) -> anyhow:: Result < ( ) > {
12- let has_needed_entries = bool_field ( compiler_config, "add_functions_debug_info" )
14+ let mut has_needed_entries = bool_field ( compiler_config, "add_functions_debug_info" )
1315 && bool_field_or_unstable ( compiler_config, "add_statements_code_locations_debug_info" )
1416 && bool_field_or_unstable ( compiler_config, "add_statements_functions_debug_info" )
1517 && str_field ( compiler_config, "compiler_optimizations" ) == "Disabled" ;
1618
17- let required_cairo_config_section = formatdoc ! {
19+ let mut required_cairo_config_section = formatdoc ! {
1820 "skip-optimizations = true
1921 unstable-add-statements-code-locations-debug-info = true
2022 unstable-add-statements-functions-debug-info = true
2123 add-functions-debug-info = true
2224 "
2325 } ;
2426
25- // TODO(#4476): disabled for now due to `add-types-debug-info = true` causing compile error.
26- // `add-types-debug-info` annotations are available from Scarb 2.19 .0 onwards.
27+ // TODO: change scarb version when it comes out
28+ // `add-types-debug-info` annotations are available and bug-free from Scarb 2.20 .0 onwards.
2729 // Require them for **much** better UX.
28- // if scarb_version().is_ok_and(|version| version.scarb >= Version::new(2, 19 , 0)) {
29- // has_needed_entries &= bool_field(compiler_config, "add_types_debug_info");
30- // required_cairo_config_section += "\nadd-types-debug-info = true";
31- // }
30+ if scarb_version ( ) . is_ok_and ( |version| version. scarb >= Version :: new ( 2 , 20 , 0 ) ) {
31+ has_needed_entries &= bool_field ( compiler_config, "add_types_debug_info" ) ;
32+ required_cairo_config_section += "\n add-types-debug-info = true" ;
33+ }
3234
3335 ensure ! (
3436 has_needed_entries,
0 commit comments