Remove unused TypedHole variant from roc_can::expr::Expr

This commit is contained in:
JRI98 2024-11-28 15:46:50 +00:00
parent 46067cf28c
commit dcb6c543c0
No known key found for this signature in database
GPG key ID: F83B29916FF13F24
10 changed files with 1 additions and 25 deletions

View file

@ -718,8 +718,6 @@ fn deep_copy_expr_help<C: CopyEnv>(env: &mut C, copied: &mut Vec<Variable>, expr
symbol: *symbol,
},
TypedHole(v) => TypedHole(sub!(*v)),
RuntimeError(err) => RuntimeError(err.clone()),
}
}

View file

@ -453,7 +453,6 @@ fn expr<'a>(c: &Ctx, p: EPrec, f: &'a Arena<'a>, e: &'a Expr) -> DocBuilder<'a,
Dbg { .. } => todo!(),
Expect { .. } => todo!(),
Return { .. } => todo!(),
TypedHole(_) => todo!(),
RuntimeError(_) => todo!(),
}
}

View file

@ -333,9 +333,6 @@ pub enum Expr {
return_var: Variable,
},
/// Rendered as empty box in editor
TypedHole(Variable),
/// Compiles, but will crash if reached
RuntimeError(RuntimeError),
}
@ -411,7 +408,7 @@ impl Expr {
Self::Dbg { .. } => Category::Expect,
// these nodes place no constraints on the expression's type
Self::TypedHole(_) | Self::RuntimeError(..) => Category::Unknown,
Self::RuntimeError(..) => Category::Unknown,
}
}
}
@ -2095,7 +2092,6 @@ pub fn inline_calls(var_store: &mut VarStore, expr: Expr) -> Expr {
| other @ ParamsVar { .. }
| other @ AbilityMember(..)
| other @ RunLowLevel { .. }
| other @ TypedHole { .. }
| other @ ForeignCall { .. }
| other @ OpaqueWrapFunction(_)
| other @ Crash { .. }
@ -3460,7 +3456,6 @@ pub(crate) fn get_lookup_symbols(expr: &Expr) -> Vec<ExpectLookup> {
| Expr::RecordAccessor(_)
| Expr::SingleQuote(..)
| Expr::EmptyRecord
| Expr::TypedHole(_)
| Expr::RuntimeError(_)
| Expr::ImportParams(_, _, None)
| Expr::OpaqueWrapFunction(_) => {}

View file

@ -1055,7 +1055,6 @@ fn fix_values_captured_in_closure_expr(
| ParamsVar { .. }
| AbilityMember(..)
| EmptyRecord
| TypedHole { .. }
| RuntimeError(_)
| ZeroArgumentTag { .. }
| RecordAccessor { .. } => {}

View file

@ -406,7 +406,6 @@ pub fn walk_expr<V: Visitor>(visitor: &mut V, expr: &Expr, var: Variable) {
} => {
visitor.visit_expr(&return_value.value, return_value.region, *return_var);
}
Expr::TypedHole(_) => { /* terminal */ }
Expr::RuntimeError(..) => { /* terminal */ }
}
}

View file

@ -1815,15 +1815,6 @@ pub fn constrain_expr(
arg_cons.push(eq);
constraints.exists_many(vars, arg_cons)
}
TypedHole(var) => {
// store the expected type for this position
constraints.equal_types_var(
*var,
expected,
Category::Storage(std::file!(), std::line!()),
region,
)
}
RuntimeError(_) => {
// Runtime Errors are always going to crash, so they don't introduce any new
// constraints.
@ -4403,7 +4394,6 @@ fn is_generalizable_expr(mut expr: &Expr) -> bool {
| Expect { .. }
| Dbg { .. }
| Return { .. }
| TypedHole(_)
| RuntimeError(..)
| ZeroArgumentTag { .. }
| Tag { .. }

View file

@ -389,7 +389,6 @@ impl<'a> LowerParams<'a> {
}
| OpaqueWrapFunction(_)
| EmptyRecord
| TypedHole(_)
| RuntimeError(_)
| Num(_, _, _, _)
| Int(_, _, _, _, _)

View file

@ -5897,7 +5897,6 @@ pub fn with_hole<'a>(
Stmt::Ret(return_symbol),
)
}
TypedHole(_) => runtime_error(env, "Hit a blank"),
RuntimeError(e) => runtime_error(env, env.arena.alloc(e.runtime_message())),
Crash { msg, ret_var: _ } => {
let msg_sym = possible_reuse_symbol_or_specialize(

View file

@ -289,7 +289,6 @@ fn monomorphize_expr(expr: Expr, subs: &mut Subs) -> Expr {
variable: monomorphize_var(variable, subs),
symbol,
},
Expr::TypedHole(var) => Expr::TypedHole(monomorphize_var(var, subs)),
Expr::RuntimeError(error) => Expr::RuntimeError(error),
Expr::RunLowLevel { op, args, ret_var } => Expr::RunLowLevel {
op,

View file

@ -386,7 +386,6 @@ impl<'a, 'c, 'd, 'i, 's, 't, P: Push<Problem>> Env<'a, 'c, 'd, 'i, 's, 't, P> {
// variable,
// symbol,
// } => todo!(),
// Expr::TypedHole(variable) => todo!(),
// Expr::RuntimeError(_runtime_error) => {
// todo!("generate a MonoExpr::Crash based on the runtime error");
// }