summaryrefslogtreecommitdiff
path: root/dhall
diff options
context:
space:
mode:
authorNadrieril2020-10-28 23:40:28 +0000
committerGitHub2020-10-28 23:40:28 +0000
commitf8234684b1129dac84d09adfb24bdc0f98448b9b (patch)
tree1440cfb514fa856718074f2b1ebce801459b5c0c /dhall
parent70727acbda68e104f60ae1dbbe95adbcec08a628 (diff)
parentaf16e9699799f8cfbd228e2832e1d5df3653116b (diff)
Merge pull request #189 from Nadrieril/serialize
Diffstat (limited to 'dhall')
-rw-r--r--dhall/src/syntax/text/printer.rs4
-rw-r--r--dhall/tests/parser/success/text/templateB.txt2
-rw-r--r--dhall/tests/parser/success/unit/LambdaUnderscoreB.txt2
-rw-r--r--dhall/tests/parser/success/unit/VariableUnderscoreB.txt2
-rw-r--r--dhall/tests/type-inference/failure/unit/AssertAlphaTrap.txt2
5 files changed, 7 insertions, 5 deletions
diff --git a/dhall/src/syntax/text/printer.rs b/dhall/src/syntax/text/printer.rs
index 0c2eb2e..4b7b8b8 100644
--- a/dhall/src/syntax/text/printer.rs
+++ b/dhall/src/syntax/text/printer.rs
@@ -156,7 +156,9 @@ fn fmt_label(label: &Label, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
};
if s.is_empty() {
write!(f, "``")
- } else if !is_reserved && s.chars().all(|c| c.is_ascii_alphanumeric()) {
+ } else if !is_reserved
+ && s.chars().all(|c| c.is_ascii_alphanumeric() || c == '_')
+ {
write!(f, "{}", s)
} else {
write!(f, "`{}`", s)
diff --git a/dhall/tests/parser/success/text/templateB.txt b/dhall/tests/parser/success/text/templateB.txt
index 74303d3..939aa18 100644
--- a/dhall/tests/parser/success/text/templateB.txt
+++ b/dhall/tests/parser/success/text/templateB.txt
@@ -1 +1 @@
-λ(record : { `in_ca` : Bool, name : Text, `taxed_value` : Double, value : Double }) → "Hello ${ record.name }\nYou have just won ${ Double/show record.value } dollars!\n${ if record.`in_ca` then "Well, ${ Double/show record.`taxed_value` } dollars, after taxes" else "" }\n"
+λ(record : { in_ca : Bool, name : Text, taxed_value : Double, value : Double }) → "Hello ${ record.name }\nYou have just won ${ Double/show record.value } dollars!\n${ if record.in_ca then "Well, ${ Double/show record.taxed_value } dollars, after taxes" else "" }\n"
diff --git a/dhall/tests/parser/success/unit/LambdaUnderscoreB.txt b/dhall/tests/parser/success/unit/LambdaUnderscoreB.txt
index 10000d0..32719f0 100644
--- a/dhall/tests/parser/success/unit/LambdaUnderscoreB.txt
+++ b/dhall/tests/parser/success/unit/LambdaUnderscoreB.txt
@@ -1 +1 @@
-λ(`_` : T) → x
+λ(_ : T) → x
diff --git a/dhall/tests/parser/success/unit/VariableUnderscoreB.txt b/dhall/tests/parser/success/unit/VariableUnderscoreB.txt
index 5824cab..31354ec 100644
--- a/dhall/tests/parser/success/unit/VariableUnderscoreB.txt
+++ b/dhall/tests/parser/success/unit/VariableUnderscoreB.txt
@@ -1 +1 @@
-`_`
+_
diff --git a/dhall/tests/type-inference/failure/unit/AssertAlphaTrap.txt b/dhall/tests/type-inference/failure/unit/AssertAlphaTrap.txt
index 0798b19..7241266 100644
--- a/dhall/tests/type-inference/failure/unit/AssertAlphaTrap.txt
+++ b/dhall/tests/type-inference/failure/unit/AssertAlphaTrap.txt
@@ -1,4 +1,4 @@
-Type error: error: unbound variable ``_``
+Type error: error: unbound variable `_`
--> <current file>:1:47
|
1 | assert : (\(_: Bool) -> _) === (\(x: Bool) -> _)