fn check_state_param(env: &mut CompilationEnv, state_ty: &Type, struct_name: &Option<StructName>) {
    match &state_ty.value {
        Type_::Apply(access, _) => {
            if let Some(expected_name) = struct_name {
                let given_name = match access.value {
                    NameAccessChain_::One(n) => n,
                    _ => {
                        env.add_diag(diag!(
                            Derivation::DeriveFailed,
                            (
                                access.loc,
                                "qualified type name not supported to reference actor state"
                            )
                        ));
                        return;
                    }
                };
                if given_name.value != expected_name.0.value {
                    env.add_diag(diag!(
                        Derivation::DeriveFailed,
                        (
                            state_ty.loc,
                            format!(
                                "expected actor state type `{}` but found `{}`",
                                expected_name, given_name
                            )
                        )
                    ));
                }
            }
        }
        _ => env.add_diag(diag!(
            Derivation::DeriveFailed,
            (state_ty.loc, "expected a struct type".to_string())
        )),
    }
}
/// Checks whether the type is the actor state.
Checks whether the type is the actor state.
Checks whether the type is the actor state .
fn check_state_param(env: &mut CompilationEnv, state_ty: &Type, struct_name: &Option<StructName>) {
    match &state_ty.value {
        Type_::Apply(access, _) => {
            if let Some(expected_name) = struct_name {
                let given_name = match access.value {
                    NameAccessChain_::One(n) => n,
                    _ => {
                        env.add_diag(diag!(
                            Derivation::DeriveFailed,
                            (
                                access.loc,
                                "qualified type name not supported to reference actor state"
                            )
                        ));
                        return;
                    }
                };
                if given_name.value != expected_name.0.value {
                    env.add_diag(diag!(
                        Derivation::DeriveFailed,
                        (
                            state_ty.loc,
                            format!(
                                "expected actor state type `{}` but found `{}`",
                                expected_name, given_name
                            )
                        )
                    ));
                }
            }
        }
        _ => env.add_diag(diag!(
            Derivation::DeriveFailed,
            (state_ty.loc, "expected a struct type".to_string())
        )),
    }
}
fn check_state_param ( env : & mut CompilationEnv , state_ty : & Type , struct_name : & Option < StructName > ) { match & state_ty . value { Type_ :: Apply ( access , _ ) => { if let Some ( expected_name ) = struct_name { let given_name = match access . value { NameAccessChain_ :: One ( n ) => n , _ => { env . add_diag ( diag ! ( Derivation DeriveFailed ( access loc " " ) ) ) ; return ; } } ; if given_name . value != expected_name . 0 . value { env . add_diag ( diag ! ( Derivation DeriveFailed ( state_ty loc format ( " " expected_name given_name ) ) ) ) ; } } } _ => env . add_diag ( diag ! ( Derivation DeriveFailed ( state_ty loc " " to_string ( ) ) ) ) , } }
Checks whether the type is the actor state.
Checks whether the type is the actor state .
env
&mut CompilationEnv
state_ty
&Type
struct_name
&Option<StructName>