From db6c09f33c3c794e4b6ec8a7aa80978d945a9d7a Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 29 Jan 2020 21:26:42 +0000 Subject: Remove dead code --- dhall/src/error/mod.rs | 17 +- dhall/src/semantics/core/context.rs | 95 ----- dhall/src/semantics/core/value.rs | 32 -- dhall/src/semantics/core/visitor.rs | 8 - dhall/src/semantics/nze/nzexpr.rs | 411 +--------------------- dhall/src/semantics/phase/normalize.rs | 7 - dhall/src/semantics/phase/typecheck.rs | 624 +-------------------------------- dhall/src/semantics/tck/tyexpr.rs | 5 - dhall/src/semantics/tck/typecheck.rs | 30 +- dhall/src/syntax/ast/expr.rs | 4 - 10 files changed, 31 insertions(+), 1202 deletions(-) (limited to 'dhall') diff --git a/dhall/src/error/mod.rs b/dhall/src/error/mod.rs index 5330c59..215a7bf 100644 --- a/dhall/src/error/mod.rs +++ b/dhall/src/error/mod.rs @@ -3,7 +3,7 @@ use std::io::Error as IOError; use crate::semantics::core::value::Value; use crate::semantics::phase::resolve::ImportStack; use crate::semantics::phase::NormalizedExpr; -use crate::syntax::{Import, Label, ParseError, Span}; +use crate::syntax::{Import, ParseError}; pub type Result = std::result::Result; @@ -45,7 +45,7 @@ pub struct TypeError { /// The specific type error #[derive(Debug)] pub(crate) enum TypeMessage { - UnboundVariable(Span), + // UnboundVariable(Span), InvalidInputType(Value), InvalidOutputType(Value), // NotAFunction(Value), @@ -57,7 +57,7 @@ pub(crate) enum TypeMessage { // InvalidPredicate(Value), // IfBranchMismatch(Value, Value), // IfBranchMustBeTerm(bool, Value), - InvalidFieldType(Label, Value), + // InvalidFieldType(Label, Value), // NotARecord(Label, Value), // MustCombineRecord(Value), // MissingRecordField(Label, Value), @@ -76,9 +76,9 @@ pub(crate) enum TypeMessage { // ProjectionMissingEntry, // ProjectionDuplicateField, Sort, - RecordTypeDuplicateField, + // RecordTypeDuplicateField, // RecordTypeMergeRequiresRecordType(Value), - UnionTypeDuplicateField, + // UnionTypeDuplicateField, // EquivalenceArgumentMustBeTerm(bool, Value), // EquivalenceTypeMismatch(Value, Value), // AssertMismatch(Value, Value), @@ -96,7 +96,7 @@ impl std::fmt::Display for TypeError { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { use TypeMessage::*; let msg = match &self.message { - UnboundVariable(var) => var.error("Type error: Unbound variable"), + // UnboundVariable(var) => var.error("Type error: Unbound variable"), InvalidInputType(v) => { v.span().error("Type error: Invalid function input") } @@ -171,8 +171,3 @@ impl From for Error { Error::Typecheck(err) } } -impl From for Error { - fn from(_: crate::semantics::nze::nzexpr::TypeError) -> Error { - Error::Decode(DecodeError::WrongFormatError("type error".to_string())) - } -} diff --git a/dhall/src/semantics/core/context.rs b/dhall/src/semantics/core/context.rs index 9749c50..8b13789 100644 --- a/dhall/src/semantics/core/context.rs +++ b/dhall/src/semantics/core/context.rs @@ -1,96 +1 @@ -use crate::error::TypeError; -use crate::semantics::core::value::Value; -use crate::semantics::core::value::ValueKind; -use crate::semantics::core::var::{AlphaVar, Binder}; -use crate::semantics::nze::NzVar; -// use crate::semantics::phase::normalize::{NzEnv, NzEnvItem}; -use crate::syntax::{Label, V}; -#[derive(Debug, Clone)] -enum CtxItem { - // Variable is bound with given type - Kept(Value), - // Variable has been replaced by corresponding value - Replaced(Value), -} - -#[derive(Debug, Clone)] -pub(crate) struct TyCtx { - ctx: Vec<(Binder, CtxItem)>, -} - -impl TyCtx { - pub fn new() -> Self { - TyCtx { ctx: Vec::new() } - } - fn with_vec(&self, vec: Vec<(Binder, CtxItem)>) -> Self { - TyCtx { ctx: vec } - } - pub fn insert_type(&self, x: &Binder, t: Value) -> Self { - let mut vec = self.ctx.clone(); - vec.push((x.clone(), CtxItem::Kept(t.under_binder()))); - self.with_vec(vec) - } - pub fn insert_value( - &self, - x: &Binder, - e: Value, - ) -> Result { - let mut vec = self.ctx.clone(); - vec.push((x.clone(), CtxItem::Replaced(e))); - Ok(self.with_vec(vec)) - } - pub fn lookup(&self, var: &V