fix extra ampersands

This commit is contained in:
Folkert 2021-07-29 17:32:08 +02:00
parent b6116eeb98
commit 899cbeabd7
79 changed files with 372 additions and 376 deletions

View file

@ -452,7 +452,7 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
sorted_fields.sort_by(|(a, _), (b, _)| {
a.clone()
.as_string(interns, home)
.cmp(&b.as_string(&interns, home))
.cmp(&b.as_string(interns, home))
});
let mut any_written_yet = false;
@ -464,7 +464,7 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
any_written_yet = true;
}
buf.push_str(&label.as_string(&interns, home));
buf.push_str(&label.as_string(interns, home));
for var in vars {
buf.push(' ');
@ -496,7 +496,7 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
buf.push_str("[ ");
buf.push_str(&tag_name.as_string(&interns, home));
buf.push_str(&tag_name.as_string(interns, home));
buf.push_str(" ]");
@ -539,7 +539,7 @@ fn write_flat_type(env: &Env, flat_type: FlatType, subs: &Subs, buf: &mut String
} else {
any_written_yet = true;
}
buf.push_str(&label.as_string(&interns, home));
buf.push_str(&label.as_string(interns, home));
for var in vars {
buf.push(' ');
@ -757,7 +757,7 @@ fn write_symbol(env: &Env, symbol: Symbol, buf: &mut String) {
// 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_string(interns));
buf.push('.');
}

View file

@ -513,11 +513,11 @@ pub fn to_type(
let mut new_args = Vec::with_capacity(args.len());
for arg in args {
new_args.push(to_type(&arg, free_vars, var_store));
new_args.push(to_type(arg, free_vars, var_store));
}
let new_ret = to_type(&ret, free_vars, var_store);
let new_closure = to_type(&closure, free_vars, var_store);
let new_ret = to_type(ret, free_vars, var_store);
let new_closure = to_type(closure, free_vars, var_store);
Type::Function(new_args, Box::new(new_closure), Box::new(new_ret))
}
@ -525,13 +525,13 @@ pub fn to_type(
let mut new_args = Vec::with_capacity(args.len());
for arg in args {
new_args.push(to_type(&arg, free_vars, var_store));
new_args.push(to_type(arg, free_vars, var_store));
}
Type::Apply(*symbol, new_args)
}
Rigid(lowercase) => {
if let Some(var) = free_vars.named_vars.get(&lowercase) {
if let Some(var) = free_vars.named_vars.get(lowercase) {
Type::Variable(*var)
} else {
let var = var_store.fresh();
@ -552,9 +552,9 @@ pub fn to_type(
for (label, field) in fields {
let field_val = match field {
Required(typ) => Required(to_type(&typ, free_vars, var_store)),
Optional(typ) => Optional(to_type(&typ, free_vars, var_store)),
Demanded(typ) => Demanded(to_type(&typ, free_vars, var_store)),
Required(typ) => Required(to_type(typ, free_vars, var_store)),
Optional(typ) => Optional(to_type(typ, free_vars, var_store)),
Demanded(typ) => Demanded(to_type(typ, free_vars, var_store)),
};
new_fields.insert(label.clone(), field_val);

View file

@ -406,7 +406,7 @@ impl Type {
match self {
Variable(v) => {
if let Some(replacement) = substitutions.get(&v) {
if let Some(replacement) = substitutions.get(v) {
*self = replacement.clone();
}
}
@ -762,15 +762,15 @@ fn symbols_help(tipe: &Type, accum: &mut ImSet<Symbol>) {
match tipe {
Function(args, closure, ret) => {
symbols_help(&ret, accum);
symbols_help(&closure, accum);
symbols_help(ret, accum);
symbols_help(closure, accum);
args.iter().for_each(|arg| symbols_help(arg, accum));
}
FunctionOrTagUnion(_, _, ext) => {
symbols_help(&ext, accum);
symbols_help(ext, accum);
}
RecursiveTagUnion(_, tags, ext) | TagUnion(tags, ext) => {
symbols_help(&ext, accum);
symbols_help(ext, accum);
tags.iter()
.map(|v| v.1.iter())
.flatten()
@ -778,7 +778,7 @@ fn symbols_help(tipe: &Type, accum: &mut ImSet<Symbol>) {
}
Record(fields, ext) => {
symbols_help(&ext, accum);
symbols_help(ext, accum);
fields.values().for_each(|field| {
use RecordField::*;
@ -791,11 +791,11 @@ fn symbols_help(tipe: &Type, accum: &mut ImSet<Symbol>) {
}
Alias(alias_symbol, _, actual_type) => {
accum.insert(*alias_symbol);
symbols_help(&actual_type, accum);
symbols_help(actual_type, accum);
}
HostExposedAlias { name, actual, .. } => {
accum.insert(*name);
symbols_help(&actual, accum);
symbols_help(actual, accum);
}
Apply(symbol, args) => {
accum.insert(*symbol);