let type_var_declaration vdecl env = match vdecl with
    Ast.SynVarDeclareNoInit (dt,s) ->
      if isdef_ident s env then 
        raise_type_error ["Cannot declare ";s;" as a variable; it has already been declared."]
      else
        let new_dt = type_data_type dt env in
          (match new_dt with
               TyTemplate s -> raise_type_error ["Cannot declare templated variable ";s;" without explicit initialization."]
             | _ ->
                 let new_env = (TyVarDef (s,new_dt))::env in
                   TyVoid, new_env)
  | Ast.SynVarDeclareWithInit (dt,s,vp) ->
      if isdef_ident s env then
        raise_type_error ["Cannot declare ";s;" as a variable; it has already been declared."]
      else
        let new_dt = type_data_type dt env in
        let temp2_env = (TyVarDef (s,new_dt))::env in
        let vp_dt,new_env = type_value_producer vp temp2_env in
          if vp_dt = new_dt then
            TyVoid, new_env
          else 
            raise_type_error ["Variable ";s;" has type ";string_of_type new_dt;" but is being initialized with a value of type ";string_of_type vp_dt;"."]