pub fn is_super_type_of(&self, argument: &Type) -> bool {
        // if `self` is a `Field` then it is a super type
        // if the argument is a field element
        if let Type::FieldElement(FieldElementType::Private) = self {
            return argument.is_field_element();
        }

        // For composite types, we need to check they are structurally the same
        // and then check that their base types are super types
        if let (Type::Array(_, param_size, param_type), Type::Array(_, arg_size, arg_type)) =
            (self, argument)
        {
            let is_super_type = param_type.is_super_type_of(arg_type);

            let arity_check = param_size.is_a_super_type_of(arg_size);

            return is_super_type && arity_check;
        }

        // XXX: Should we also allow functions that ask for u16
        // to accept u8? We would need to pad the bit decomposition
        // if so.

        self == argument
    }
// A feature of the language is that `Field` is like an
// `Any` type which allows you to pass in any type which
// is fundamentally a field element. E.g all integer types
A feature of the language is that `Field` is like an
`Any` type which allows you to pass in any type which
is fundamentally a field element.
A feature of the language is that ` Field ` is like an ` Any ` type which allows you to pass in any type which is fundamentally a field element .
pub fn is_super_type_of(&self, argument: &Type) -> bool {
        // if `self` is a `Field` then it is a super type
        // if the argument is a field element
        if let Type::FieldElement(FieldElementType::Private) = self {
            return argument.is_field_element();
        }
        // For composite types, we need to check they are structurally the same
        // and then check that their base types are super types
        if let (Type::Array(_, param_size, param_type), Type::Array(_, arg_size, arg_type)) =
            (self, argument)
        {
            let is_super_type = param_type.is_super_type_of(arg_type);
            let arity_check = param_size.is_a_super_type_of(arg_size);
            return is_super_type && arity_check;
        }
        // XXX: Should we also allow functions that ask for u16
        // to accept u8? We would need to pad the bit decomposition
        // if so.
        self == argument
    }
pub fn is_super_type_of ( & self , argument : & Type ) -> bool { // if `self` is a `Field` then it is a super type // if the argument is a field element if let Type :: FieldElement ( FieldElementType :: Private ) = self { return argument . is_field_element ( ) ; } // For composite types, we need to check they are structurally the same // and then check that their base types are super types if let ( Type :: Array ( _ , param_size , param_type ) , Type :: Array ( _ , arg_size , arg_type ) ) = ( self , argument ) { let is_super_type = param_type . is_super_type_of ( arg_type ) ; let arity_check = param_size . is_a_super_type_of ( arg_size ) ; return is_super_type && arity_check ; } // XXX: Should we also allow functions that ask for u16 // to accept u8? We would need to pad the bit decomposition // if so. self == argument }
A feature of the language is that `Field` is like an
`Any` type which allows you to pass in any type which
is fundamentally a field element.
A feature of the language is that ` Field ` is like an ` Any ` type which allows you to pass in any type which is fundamentally a field element .
&self
argument
&Type
&self
argument
&Type