use IdentStr

This commit is contained in:
Folkert 2021-08-03 21:14:36 +02:00
parent bd35770e9a
commit ceb5cc66fa
30 changed files with 241 additions and 219 deletions

View file

@ -369,8 +369,10 @@ fn write_sorted_tags<'a>(
let interns = &env.interns;
let home = env.home;
sorted_fields
.sort_by(|(a, _), (b, _)| a.as_string(interns, home).cmp(&b.as_string(interns, home)));
sorted_fields.sort_by(|(a, _), (b, _)| {
a.as_ident_str(interns, home)
.cmp(&b.as_ident_str(interns, home))
});
let mut any_written_yet = false;
@ -381,7 +383,7 @@ fn write_sorted_tags<'a>(
any_written_yet = true;
}
buf.push_str(&label.as_string(interns, home));
buf.push_str(label.as_ident_str(interns, home).as_str());
for var in vars {
buf.push(' ');
@ -715,15 +717,15 @@ fn write_fn(
fn write_symbol(env: &Env, symbol: Symbol, buf: &mut String) {
let interns = &env.interns;
let ident = symbol.ident_string(interns);
let ident = symbol.ident_str(interns);
let module_id = symbol.module_id();
// Don't qualify the symbol if it's in our home module,
// or if it's a builtin (since all their types are always in scope)
if module_id != env.home && !module_id.is_builtin() {
buf.push_str(module_id.to_string(interns));
buf.push_str(module_id.to_ident_str(interns).as_str());
buf.push('.');
}
buf.push_str(ident);
buf.push_str(ident.as_str());
}

View file

@ -1,6 +1,5 @@
use crate::pretty_print::Parens;
use crate::subs::{LambdaSet, RecordFields, Subs, VarStore, Variable};
use inlinable_string::InlinableString;
use roc_collections::all::{ImMap, ImSet, Index, MutSet, SendMap};
use roc_module::ident::{ForeignSymbol, Ident, Lowercase, TagName};
use roc_module::low_level::LowLevel;
@ -1118,7 +1117,7 @@ pub enum Problem {
CanonicalizationProblem,
CircularType(Symbol, Box<ErrorType>, Region),
CyclicAlias(Symbol, Region, Vec<Symbol>),
UnrecognizedIdent(InlinableString),
UnrecognizedIdent(Ident),
Shadowed(Region, Located<Ident>),
BadTypeArguments {
symbol: Symbol,
@ -1196,7 +1195,7 @@ fn write_error_type_help(
if write_parens {
buf.push('(');
}
buf.push_str(symbol.ident_string(interns));
buf.push_str(symbol.ident_str(interns).as_str());
for arg in arguments {
buf.push(' ');