summaryrefslogtreecommitdiff
path: root/dhall/src/semantics/tck
diff options
context:
space:
mode:
authorNadrieril2020-02-02 17:49:49 +0000
committerNadrieril2020-02-02 17:49:49 +0000
commitb6625eccbf3f2d1bcfe1a88f4d556439281e91de (patch)
tree5ce5357114855d828aad5a6ba394e2b75334c5d0 /dhall/src/semantics/tck
parent4f98c23963e82eaf08c9d7291d0988d13571d337 (diff)
Use Spans consistently by value
Diffstat (limited to 'dhall/src/semantics/tck')
-rw-r--r--dhall/src/semantics/tck/tyexpr.rs4
-rw-r--r--dhall/src/semantics/tck/typecheck.rs16
2 files changed, 10 insertions, 10 deletions
diff --git a/dhall/src/semantics/tck/tyexpr.rs b/dhall/src/semantics/tck/tyexpr.rs
index 1a048f9..1886646 100644
--- a/dhall/src/semantics/tck/tyexpr.rs
+++ b/dhall/src/semantics/tck/tyexpr.rs
@@ -48,8 +48,8 @@ impl TyExpr {
pub fn kind(&self) -> &TyExprKind {
&*self.kind
}
- pub fn span(&self) -> &Span {
- &self.span
+ pub fn span(&self) -> Span {
+ self.span.clone()
}
pub fn get_type(&self) -> Result<Type, TypeError> {
match &self.ty {
diff --git a/dhall/src/semantics/tck/typecheck.rs b/dhall/src/semantics/tck/typecheck.rs
index 48794a8..7518e90 100644
--- a/dhall/src/semantics/tck/typecheck.rs
+++ b/dhall/src/semantics/tck/typecheck.rs
@@ -76,7 +76,7 @@ fn type_one_layer(
annot.get_type()?.to_expr_tyenv(env),
))
.span_err(
- &annot.span(),
+ annot.span(),
format!(
"this has type: `{}`",
annot.get_type()?.to_expr_tyenv(env)
@@ -503,11 +503,11 @@ fn type_one_layer(
"Wrong handler input type"
))
.span_err(
- &span,
+ span,
format!("in this merge expression",),
)
.span_err(
- &record.span(),
+ record.span(),
format!(
"the handler `{}` expects a value \
of type: `{}`",
@@ -516,7 +516,7 @@ fn type_one_layer(
),
)
.span_err(
- &union.span(),
+ union.span(),
format!(
"but the corresponding variant \
has type: `{}`",
@@ -538,11 +538,11 @@ fn type_one_layer(
"Handler is not a function"
))
.span_err(
- &span,
+ span,
format!("in this merge expression",),
)
.span_err(
- &record.span(),
+ record.span(),
format!(
"the handler `{}` had type: `{}`",
x,
@@ -550,7 +550,7 @@ fn type_one_layer(
),
)
.span_help(
- &union.span(),
+ union.span(),
format!(
"the corresponding variant has type: \
`{}`",
@@ -647,7 +647,7 @@ pub(crate) fn type_with(
None => {
return mkerr(
ErrorBuilder::new(format!("unbound variable `{}`", var))
- .span_err(&expr.span(), "not found in this scope")
+ .span_err(expr.span(), "not found in this scope")
.format(),
)
}