aptos-labs/aptos-core

[Feature Request][move-compiler-v2] extend `GlobalEnv::display` to print all IR constructs (including V1) in move-model

Opened this issue ยท 0 comments

๐Ÿš€ Feature Request

I just wrote this:

     exp.display(env),
     env.display(param),
     ast_debug::display_verbose(old_exp),

and we also have things like:

                let name = format!(
                    "{}::{}",
                    module.get_name().name().display(module.symbol_pool()),
                    fun.name.display(module.symbol_pool())
                );
....
            self.symbol_pool.string(spec_var_name)
...
    fn dump_field(&self, tctx: &TypeDisplayContext, fld: &FieldEnv) -> String {
        format!(
            "{}: {}",
            fld.get_name().display(tctx.env.symbol_pool()),
            fld.get_type().display(tctx)
        )
    }

and think this is pretty crazy. We should have a more standard way to get a Display and/or String object for all IR constructs. Probably we could continue to generalize/implement trait EnvDisplay and use env.display(x) for everything (and replace all existing uses so it's the obvious way to do it).