summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/tck/tyexpr.rs
diff options
context:
space:
mode:
authorNadrieril2020-01-19 18:30:13 +0000
committerNadrieril2020-01-19 18:30:13 +0000
commitaec80599f161096b68cac88ffb8852a61b62fcfa (patch)
tree945a87f97f062dcc7b0f4ec2f04dd8bc2da431ef /dhall/src/semantics/tck/tyexpr.rs
parent2f19fe1978c0fc8c456563c68ca08eb5b48ef0cd (diff)
Restore more types in value_to_tyexpr
Diffstat (limited to '')
-rw-r--r--dhall/src/semantics/tck/tyexpr.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/dhall/src/semantics/tck/tyexpr.rs b/dhall/src/semantics/tck/tyexpr.rs
index f0fcdd1..36cae04 100644
--- a/dhall/src/semantics/tck/tyexpr.rs
+++ b/dhall/src/semantics/tck/tyexpr.rs
@@ -1,4 +1,6 @@
#![allow(dead_code)]
+use crate::error::{TypeError, TypeMessage};
+use crate::semantics::core::context::TyCtx;
use crate::semantics::core::var::AlphaVar;
use crate::semantics::phase::typecheck::rc;
use crate::semantics::phase::Normalized;
@@ -33,11 +35,21 @@ impl TyExpr {
pub fn kind(&self) -> &TyExprKind {
&*self.kind
}
+ pub fn get_type(&self) -> Result<Type, TypeError> {
+ match &self.ty {
+ Some(t) => Ok(t.clone()),
+ None => Err(TypeError::new(&TyCtx::new(), TypeMessage::Sort)),
+ }
+ }
/// Converts a value back to the corresponding AST expression.
- pub fn to_expr<'a>(&'a self, opts: ToExprOptions) -> NormalizedExpr {
+ pub fn to_expr(&self, opts: ToExprOptions) -> NormalizedExpr {
tyexpr_to_expr(self, opts, &mut Vec::new())
}
+ // TODO: temporary hack
+ pub fn to_value(&self) -> Value {
+ todo!()
+ }
}
fn tyexpr_to_expr<'a>(