Skip to content

Commit 03c866e

Browse files
committed
Clean up remaining calls to SpanValue::empty_fixme
1 parent a981624 commit 03c866e

File tree

3 files changed

+23
-35
lines changed

3 files changed

+23
-35
lines changed

fathom/src/core/semantics.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ impl<'arena> SpanValue<'arena> {
2323
self.0
2424
}
2525

26-
pub fn empty_fixme(val: Arc<Value<'arena>>) -> Self {
27-
SpanValue::empty(val)
28-
}
29-
3026
pub fn empty(val: Arc<Value<'arena>>) -> Self {
3127
SpanValue(Span::Empty, val)
3228
}
@@ -436,13 +432,13 @@ macro_rules! step {
436432
macro_rules! const_step {
437433
([$($input:ident : $Input:ident),*] => $output:expr) => {
438434
step!(_, [$($input),*] => match ($($input.1.as_ref(),)*) {
439-
($(Value::ConstLit(Const::$Input($input, ..)),)*) => SpanValue::empty_fixme(Arc::new(Value::ConstLit($output))),
435+
($(Value::ConstLit(Const::$Input($input, ..)),)*) => SpanValue::empty(Arc::new(Value::ConstLit($output))),
440436
_ => return None,
441437
})
442438
};
443439
([$($input:ident , $style:ident : $Input:ident),*] => $output:expr) => {
444440
step!(_, [$($input),*] => match ($($input.1.as_ref(),)*) {
445-
($(Value::ConstLit(Const::$Input($input, $style)),)*) => SpanValue::empty_fixme(Arc::new(Value::ConstLit($output))),
441+
($(Value::ConstLit(Const::$Input($input, $style)),)*) => SpanValue::empty(Arc::new(Value::ConstLit($output))),
446442
_ => return None,
447443
})
448444
};
@@ -611,7 +607,7 @@ fn prim_step(prim: Prim) -> Option<PrimStep> {
611607
_ => return None,
612608
}
613609
}
614-
SpanValue::empty_fixme(Arc::new(Value::prim(Prim::OptionNone, [])))
610+
SpanValue::empty(Arc::new(Value::prim(Prim::OptionNone, [])))
615611
}
616612
_ => return None,
617613
})
@@ -1125,7 +1121,7 @@ impl<'in_arena, 'out_arena, 'env> QuoteContext<'in_arena, 'out_arena, 'env> {
11251121
let var = Arc::new(Value::rigid_var(self.rigid_exprs.next_global()));
11261122
let value = self
11271123
.elim_context()
1128-
.apply_closure(closure, SpanValue::empty_fixme(var));
1124+
.apply_closure(closure, SpanValue::empty(var));
11291125

11301126
self.push_rigid();
11311127
let term = self.quote(&value);
@@ -1145,7 +1141,7 @@ impl<'in_arena, 'out_arena, 'env> QuoteContext<'in_arena, 'out_arena, 'env> {
11451141

11461142
while let Some((value, next_telescope)) = self.elim_context().split_telescope(telescope) {
11471143
let var = Arc::new(Value::rigid_var(self.rigid_exprs.next_global()));
1148-
telescope = next_telescope(SpanValue::empty_fixme(var));
1144+
telescope = next_telescope(SpanValue::empty(var));
11491145
terms.push(self.quote(&value));
11501146
self.rigid_exprs.push();
11511147
}
@@ -1316,8 +1312,7 @@ impl<'arena, 'env> ConversionContext<'arena, 'env> {
13161312
return false;
13171313
}
13181314

1319-
let var =
1320-
SpanValue::empty_fixme(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
1315+
let var = SpanValue::empty(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
13211316
telescope0 = next_telescope0(var.clone());
13221317
telescope1 = next_telescope1(var);
13231318
self.rigid_exprs.push();

fathom/src/surface/elaboration.rs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,7 @@ impl<'arena> RigidEnv<'arena> {
498498
fn push_param(&mut self, name: Option<StringId>, r#type: ArcValue<'arena>) -> ArcValue<'arena> {
499499
// An expression that refers to itself once it is pushed onto the rigid
500500
// expression environment.
501-
let expr =
502-
SpanValue::empty_fixme(Arc::new(Value::rigid_var(self.exprs.len().next_global())));
501+
let expr = SpanValue::empty(Arc::new(Value::rigid_var(self.exprs.len().next_global())));
503502

504503
self.names.push(name);
505504
self.types.push(r#type);
@@ -1253,7 +1252,7 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
12531252
}
12541253
Pattern::BooleanLiteral(range, val) => {
12551254
let r#const = Const::Bool(*val);
1256-
let r#type = SpanValue::empty_fixme(Arc::new(Value::prim(Prim::BoolType, [])));
1255+
let r#type = SpanValue::empty(Arc::new(Value::prim(Prim::BoolType, [])));
12571256
(CheckedPattern::Const(*range, r#const), r#type)
12581257
}
12591258
}
@@ -1861,12 +1860,12 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
18611860

18621861
(
18631862
core::Term::RecordLit(range.into(), labels, exprs.into()),
1864-
SpanValue::empty_fixme(Arc::new(Value::RecordType(labels, types))),
1863+
SpanValue::empty(Arc::new(Value::RecordType(labels, types))),
18651864
)
18661865
}
18671866
Term::UnitLiteral(range) => (
18681867
core::Term::RecordLit(range.into(), &[], &[]),
1869-
SpanValue::empty_fixme(Arc::new(Value::RecordType(
1868+
SpanValue::empty(Arc::new(Value::RecordType(
18701869
&[],
18711870
Telescope::new(SharedEnv::new(), &[]),
18721871
))),
@@ -1924,15 +1923,14 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
19241923
self.synth_reported_error(*range)
19251924
}
19261925
Term::BooleanLiteral(range, val) => {
1927-
let bool_type = SpanValue::empty_fixme(Arc::new(Value::prim(Prim::BoolType, [])));
1926+
let bool_type = SpanValue::empty(Arc::new(Value::prim(Prim::BoolType, [])));
19281927
(
19291928
core::Term::ConstLit(range.into(), Const::Bool(*val)),
19301929
bool_type,
19311930
)
19321931
}
19331932
Term::FormatRecord(range, format_fields) => {
1934-
let format_type =
1935-
SpanValue::empty_fixme(Arc::new(Value::prim(Prim::FormatType, [])));
1933+
let format_type = SpanValue::empty(Arc::new(Value::prim(Prim::FormatType, [])));
19361934
let (labels, formats) = self.check_format_fields(*range, format_fields);
19371935

19381936
(
@@ -1941,13 +1939,12 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
19411939
)
19421940
}
19431941
Term::FormatCond(range, (_, name), format, pred) => {
1944-
let format_type =
1945-
SpanValue::empty_fixme(Arc::new(Value::prim(Prim::FormatType, [])));
1942+
let format_type = SpanValue::empty(Arc::new(Value::prim(Prim::FormatType, [])));
19461943
let format = self.check(format, &format_type);
19471944
let format_value = self.eval_context().eval(&format);
19481945
let repr_type = self.elim_context().format_repr(&format_value);
19491946
self.rigid_env.push_param(Some(*name), repr_type);
1950-
let bool_type = SpanValue::empty_fixme(Arc::new(Value::prim(Prim::BoolType, [])));
1947+
let bool_type = SpanValue::empty(Arc::new(Value::prim(Prim::BoolType, [])));
19511948
let pred_expr = self.check(pred, &bool_type);
19521949
self.rigid_env.pop();
19531950

@@ -1962,8 +1959,7 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
19621959
)
19631960
}
19641961
Term::FormatOverlap(range, format_fields) => {
1965-
let format_type =
1966-
SpanValue::empty_fixme(Arc::new(Value::prim(Prim::FormatType, [])));
1962+
let format_type = SpanValue::empty(Arc::new(Value::prim(Prim::FormatType, [])));
19671963
let (labels, formats) = self.check_format_fields(*range, format_fields);
19681964

19691965
(
@@ -2300,7 +2296,7 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
23002296
// TODO: Maybe it would be good to reuse lhs_type here if output_type is the same
23012297
(
23022298
fun_app,
2303-
SpanValue::empty_fixme(Arc::new(Value::prim(output_type, []))),
2299+
SpanValue::empty(Arc::new(Value::prim(output_type, []))),
23042300
)
23052301
}
23062302

@@ -2320,8 +2316,8 @@ impl<'interner, 'arena, 'error> Context<'interner, 'arena, 'error> {
23202316
format_fields: &[FormatField<'_, ByteRange>],
23212317
) -> (&'arena [StringId], &'arena [core::Term<'arena>]) {
23222318
let universe_type = Value::arc_universe();
2323-
let format_type = SpanValue::empty_fixme(Arc::new(Value::prim(Prim::FormatType, [])));
2324-
let bool_type = SpanValue::empty_fixme(Arc::new(Value::prim(Prim::BoolType, [])));
2319+
let format_type = SpanValue::empty(Arc::new(Value::prim(Prim::FormatType, [])));
2320+
let bool_type = SpanValue::empty(Arc::new(Value::prim(Prim::BoolType, [])));
23252321

23262322
let initial_rigid_len = self.rigid_env.len();
23272323
let (labels, format_fields) =

fathom/src/surface/elaboration/unification.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ impl<'arena, 'env> Context<'arena, 'env> {
332332
closure0: &Closure<'arena>,
333333
closure1: &Closure<'arena>,
334334
) -> Result<(), Error> {
335-
let var =
336-
SpanValue::empty_fixme(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
335+
let var = SpanValue::empty(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
337336
let value0 = self.elim_context().apply_closure(closure0, var.clone());
338337
let value1 = self.elim_context().apply_closure(closure1, var);
339338

@@ -367,8 +366,7 @@ impl<'arena, 'env> Context<'arena, 'env> {
367366
return Err(error);
368367
}
369368

370-
let var =
371-
SpanValue::empty_fixme(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
369+
let var = SpanValue::empty(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
372370
telescope0 = next_telescope0(var.clone());
373371
telescope1 = next_telescope1(var);
374372
self.rigid_exprs.push();
@@ -388,8 +386,7 @@ impl<'arena, 'env> Context<'arena, 'env> {
388386
output_expr: &Closure<'arena>,
389387
value: &ArcValue<'arena>,
390388
) -> Result<(), Error> {
391-
let var =
392-
SpanValue::empty_fixme(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
389+
let var = SpanValue::empty(Arc::new(Value::rigid_var(self.rigid_exprs.next_global())));
393390
let value = self.elim_context().fun_app(value.clone(), var.clone());
394391
let output_expr = self.elim_context().apply_closure(output_expr, var);
395392

@@ -666,7 +663,7 @@ impl<'arena, 'env> Context<'arena, 'env> {
666663
match self.rename(flexible_var, &value) {
667664
Ok(term) => {
668665
terms.push(term);
669-
let var = SpanValue::empty_fixme(Arc::new(Value::rigid_var(
666+
let var = SpanValue::empty(Arc::new(Value::rigid_var(
670667
self.rigid_exprs.next_global(),
671668
)));
672669
telescope = next_telescope(var);
@@ -711,7 +708,7 @@ impl PartialRenaming {
711708
}
712709

713710
fn next_rigid_var<'arena>(&self) -> ArcValue<'arena> {
714-
SpanValue::empty_fixme(Arc::new(Value::rigid_var(self.source.len().next_global())))
711+
SpanValue::empty(Arc::new(Value::rigid_var(self.source.len().next_global())))
715712
}
716713

717714
/// Set a rigid source variable to rigid target variable mapping, ensuring

0 commit comments

Comments
 (0)