diff --git a/src/lib.rs b/src/lib.rs index 48068ed..88893fc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -35,24 +35,25 @@ pub fn find_entry_point_by_name<'a>( .find(|x| x.id.debug_name.as_ref().map(|x| x.as_str()) == Some(name)) } -// If type is a single element container, finds it's inner type +// If type is invisible to sierra (i.e. a single element container), +// finds it's actual concrete type recursively. // If not, returns the current type -pub fn find_inner_type( +pub fn find_real_type( registry: &ProgramRegistry, ty: &ConcreteTypeId, ) -> ConcreteTypeId { match registry.get_type(ty).unwrap() { cairo_lang_sierra::extensions::core::CoreTypeConcrete::Box(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } cairo_lang_sierra::extensions::core::CoreTypeConcrete::Uninitialized(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } cairo_lang_sierra::extensions::core::CoreTypeConcrete::Span(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } cairo_lang_sierra::extensions::core::CoreTypeConcrete::Snapshot(info) => { - find_inner_type(registry, &info.ty) + find_real_type(registry, &info.ty) } _ => ty.clone(), } diff --git a/src/vm/array.rs b/src/vm/array.rs index 0c9d092..4f45f56 100644 --- a/src/vm/array.rs +++ b/src/vm/array.rs @@ -1,5 +1,5 @@ use super::EvalAction; -use crate::{find_inner_type, Value}; +use crate::{find_real_type, Value}; use cairo_lang_sierra::{ extensions::{ array::ArrayConcreteLibfunc, @@ -47,7 +47,7 @@ fn eval_span_from_tuple( }; let ty = &info.branch_signatures()[0].vars[0].ty; - let ty = find_inner_type(registry, ty); + let ty = find_real_type(registry, ty); let CoreTypeConcrete::Array(info) = registry.get_type(&ty).unwrap() else { panic!()