pub fn localize_targs<'a>(
    env: &mut Env<'a>,
    use_pos: &'a OwnedPos,
    use_name: &'a str,
    tparams: &'a [Tparam<'a>],
    targs: &[ast::Targ],
) -> Vec<tast::Targ<'a>> {
    if targs.len() != 0 {
        unimplemented!("Explicit type arguments not supported")
    }
    // TODO(hrust) localize explicit type arguments
    let explicit_targs = std::iter::empty();
    // Generate fresh type variables for the remainder
    let implicit_targs = tparams[targs.len()..].iter().map(|tparam| {
        let tvar = env
            .inference_env
            .fresh_type_reason(env.bld().mk_rtype_variable_generics(
                Pos::from_oxidized_in(use_pos, env.bld().alloc),
                tparam.name.name(),
                use_name,
            ));
        // TODO(hrust) logging
        tast::Targ(
            tvar,
            Hint(
                use_pos.clone(),
                Box::new(Hint_::Happly(
                    OwnedId(OwnedPos::make_none(), typehints::WILDCARD.to_string()),
                    vec![],
                )),
            ),
        )
    });

    explicit_targs.chain(implicit_targs).collect()
}
/// Declare and localize the type arguments to a constructor or function, given
/// information about the declared type parameters in `decl_tparam list`. If no
/// explicit type arguments are given, generate fresh type variables in their
/// place; do the same for any wildcard explicit type arguments.
/// Report arity errors using `def_pos` (for the declared parameters), `use_pos`
/// (for the use-site) and `use_name` (the name of the constructor or function).
Declare and localize the type arguments to a constructor or function, given
information about the declared type parameters in `decl_tparam list`. If no
explicit type arguments are given, generate fresh type variables in their
place; do the same for any wildcard explicit type arguments.
Declare and localize the type arguments to a constructor or function given information about the declared type parameters in ` decl_tparam list ` . If no explicit type arguments are given generate fresh type variables in their place ; do the same for any wildcard explicit type arguments .
pub fn localize_targs<'a>(
    env: &mut Env<'a>,
    use_pos: &'a OwnedPos,
    use_name: &'a str,
    tparams: &'a [Tparam<'a>],
    targs: &[ast::Targ],
) -> Vec<tast::Targ<'a>> {
    if targs.len() != 0 {
        unimplemented!("Explicit type arguments not supported")
    }
    // TODO(hrust) localize explicit type arguments
    let explicit_targs = std::iter::empty();
    // Generate fresh type variables for the remainder
    let implicit_targs = tparams[targs.len()..].iter().map(|tparam| {
        let tvar = env
            .inference_env
            .fresh_type_reason(env.bld().mk_rtype_variable_generics(
                Pos::from_oxidized_in(use_pos, env.bld().alloc),
                tparam.name.name(),
                use_name,
            ));
        // TODO(hrust) logging
        tast::Targ(
            tvar,
            Hint(
                use_pos.clone(),
                Box::new(Hint_::Happly(
                    OwnedId(OwnedPos::make_none(), typehints::WILDCARD.to_string()),
                    vec![],
                )),
            ),
        )
    });
    explicit_targs.chain(implicit_targs).collect()
}
pub fn localize_targs < ' a > ( env : & mut Env < ' a > , use_pos : & ' a OwnedPos , use_name : & ' a str , tparams : & ' a [ Tparam < ' a > ] , targs : & [ ast :: Targ ] , ) -> Vec < tast :: Targ < ' a > > { if targs . len ( ) != 0 { unimplemented ! ( " " ) } // TODO(hrust) localize explicit type arguments let explicit_targs = std :: iter :: empty ( ) ; // Generate fresh type variables for the remainder let implicit_targs = tparams [ targs . len ( ) .. ] . iter ( ) . map ( | tparam | { let tvar = env . inference_env . fresh_type_reason ( env . bld ( ) . mk_rtype_variable_generics ( Pos :: from_oxidized_in ( use_pos , env . bld ( ) . alloc ) , tparam . name . name ( ) , use_name , ) ) ; // TODO(hrust) logging tast :: Targ ( tvar , Hint ( use_pos . clone ( ) , Box :: new ( Hint_ :: Happly ( OwnedId ( OwnedPos :: make_none ( ) , typehints :: WILDCARD . to_string ( ) ) , vec ! [ ] , ) ) , ) , ) } ) ; explicit_targs . chain ( implicit_targs ) . collect ( ) }
Declare and localize the type arguments to a constructor or function, given
information about the declared type parameters in `decl_tparam list`.
Declare and localize the type arguments to a constructor or function given information about the declared type parameters in ` decl_tparam list ` .
env
&mut Env<'a>
use_pos
&'a OwnedPos
use_name
&'a str
tparams
&'a [Tparam<'a>]
targs
&[ast::Targ]