Skip to content

Commit

Permalink
Fix types in parser tests (#366)
Browse files Browse the repository at this point in the history
The parser tests had a number of cases where they had Natural and
Integer syntax swapped round.  This presumably dates from before #138
switched the grammar of Integer and Natural.

Note that this difference doesn't actually matter for these parsing
tests, because an expression like `+1 : Natural` still parses correctly,
it just fails to typecheck.  But I found it confusing to have the syntax
so consistently backwards in the tests, so I thought it was worth
changing.
  • Loading branch information
philandstuff authored and Gabriella439 committed Feb 9, 2019
1 parent c409b11 commit 471037f
Show file tree
Hide file tree
Showing 27 changed files with 98 additions and 99 deletions.
8 changes: 4 additions & 4 deletions tests/parser/success/annotationsA.dhall
@@ -1,4 +1,4 @@
{ foo = ([] : List Integer) # [1, 2, 3] # ([1, 2, 3] : List Integer)
, bar = [] : Optional Integer
, baz = [1] : Optional Integer
} : { foo : List Integer, bar : Optional Integer, baz : Optional Integer }
{ foo = ([] : List Natural) # [1, 2, 3] # ([1, 2, 3] : List Natural)
, bar = [] : Optional Natural
, baz = [1] : Optional Natural
} : { foo : List Natural, bar : Optional Natural, baz : Optional Natural }
42 changes: 21 additions & 21 deletions tests/parser/success/annotationsB.json
Expand Up @@ -3,6 +3,18 @@
[
8,
{
"bar": [
5,
"Natural"
],
"baz": [
5,
"Natural",
[
15,
1
]
],
"foo": [
3,
7,
Expand All @@ -11,7 +23,7 @@
7,
[
4,
"Integer"
"Natural"
],
[
4,
Expand Down Expand Up @@ -51,41 +63,29 @@
[
0,
"List",
"Integer"
"Natural"
]
]
],
"bar": [
5,
"Integer"
],
"baz": [
5,
"Integer",
[
15,
1
]
]
}
],
[
7,
{
"foo": [
0,
"List",
"Integer"
],
"bar": [
0,
"Optional",
"Integer"
"Natural"
],
"baz": [
0,
"Optional",
"Integer"
"Natural"
],
"foo": [
0,
"List",
"Natural"
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/success/asTextB.json
Expand Up @@ -2,8 +2,8 @@
24,
null,
1,
null,
1,
null,
"example.com",
"foo",
null,
Expand Down
9 changes: 0 additions & 9 deletions tests/parser/success/doubleB.json
@@ -1,9 +0,0 @@
[
4,
null,
1.1,
-1.1,
10,
11,
-1.1
]
2 changes: 1 addition & 1 deletion tests/parser/success/interpolatedDoubleQuotedStringA.dhall
@@ -1 +1 @@
"ABC${Integer/show 123}"
"ABC${Natural/show 123}"
2 changes: 1 addition & 1 deletion tests/parser/success/interpolatedDoubleQuotedStringB.json
Expand Up @@ -3,7 +3,7 @@
"ABC",
[
0,
"Integer/show",
"Natural/show",
[
15,
123
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/success/interpolatedSingleQuotedStringA.dhall
@@ -1,4 +1,4 @@
''
ABC
${Integer/show 123}
${Natural/show 123}
''
2 changes: 1 addition & 1 deletion tests/parser/success/interpolatedSingleQuotedStringB.json
Expand Up @@ -3,7 +3,7 @@
"ABC\n",
[
0,
"Integer/show",
"Natural/show",
[
15,
123
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/success/letA.dhall
@@ -1,3 +1,3 @@
let x = 1
in let y : Integer = 2
in let y : Natural = 2
in x
2 changes: 1 addition & 1 deletion tests/parser/success/letB.json
Expand Up @@ -9,7 +9,7 @@
[
25,
"y",
"Integer",
"Natural",
[
15,
2
Expand Down
4 changes: 2 additions & 2 deletions tests/parser/success/listA.dhall
@@ -1,4 +1,4 @@
[ [1, 2, 3]
, [1, 2, 3] : List Integer
[ [+1, +2, +3]
, [+1, +2, +3] : List Integer
, [] : List Integer
]
34 changes: 21 additions & 13 deletions tests/parser/success/listB.json
Expand Up @@ -5,32 +5,40 @@
4,
null,
[
15,
16,
1
],
[
15,
16,
2
],
[
15,
16,
3
]
],
[
4,
null,
26,
[
15,
1
4,
null,
[
16,
1
],
[
16,
2
],
[
16,
3
]
],
[
15,
2
],
[
15,
3
0,
"List",
"Integer"
]
],
[
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/success/naturalA.dhall
@@ -1 +1 @@
[ +0, +1, +01, +10 ]
[ 0, 1, 01, 10 ]
8 changes: 4 additions & 4 deletions tests/parser/success/naturalB.json
Expand Up @@ -2,19 +2,19 @@
4,
null,
[
16,
15,
0
],
[
16,
15,
1
],
[
16,
15,
1
],
[
16,
15,
10
]
]
2 changes: 1 addition & 1 deletion tests/parser/success/operatorsA.dhall
@@ -1,2 +1,2 @@
{ foo = (False && Natural/even (+1 + +2 * +3)) || True == False != True }
{ foo = (False && Natural/even (1 + 2 * 3)) || True == False != True }
{ bar = [ "ABC" ++ "DEF" ] # [ "GHI" ] } { baz = True }
6 changes: 3 additions & 3 deletions tests/parser/success/operatorsB.json
Expand Up @@ -18,18 +18,18 @@
3,
4,
[
16,
15,
1
],
[
3,
5,
[
16,
15,
2
],
[
16,
15,
3
]
]
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/success/parenthesizeUsingB.json
Expand Up @@ -5,6 +5,7 @@
"b0e3ec1797b32c80c0bcb7e8254b08c7e9e35e75e6b410c7ac21477ab90167ad"
],
0,
1,
[
24,
[
Expand All @@ -15,7 +16,6 @@
3,
"a.dhall"
],
1,
"raw.githubusercontent.com",
"dhall-lang",
"Prelude",
Expand Down
14 changes: 7 additions & 7 deletions tests/parser/success/pathTerminationB.json
Expand Up @@ -21,13 +21,6 @@
[
8,
{
"qux": [
24,
null,
0,
3,
"example"
],
"bar": [
12,
"baz",
Expand All @@ -39,6 +32,13 @@
"example"
],
{}
],
"qux": [
24,
null,
0,
3,
"example"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion tests/parser/success/quotedPathsB.json
Expand Up @@ -14,8 +14,8 @@
24,
null,
0,
null,
1,
null,
"example.com",
"foo",
"bar?baz",
Expand Down
4 changes: 2 additions & 2 deletions tests/parser/success/recordA.dhall
@@ -1,4 +1,4 @@
{ foo = 1
, bar = +2
{ foo = +1
, bar = 2
, baz = True
} : { foo : Integer, bar : Natural, baz : Bool }
16 changes: 8 additions & 8 deletions tests/parser/success/recordB.json
Expand Up @@ -3,23 +3,23 @@
[
8,
{
"foo": [
15,
1
],
"bar": [
16,
15,
2
],
"baz": true
"baz": true,
"foo": [
16,
1
]
}
],
[
7,
{
"foo": "Integer",
"bar": "Natural",
"baz": "Bool"
"baz": "Bool",
"foo": "Integer"
}
]
]
2 changes: 1 addition & 1 deletion tests/parser/success/reservedPrefixA.dhall
@@ -1 +1 @@
let TypeSynonym = Integer in 1 : TypeSynonym
let TypeSynonym = Integer in +1 : TypeSynonym
2 changes: 1 addition & 1 deletion tests/parser/success/reservedPrefixB.json
Expand Up @@ -6,7 +6,7 @@
[
26,
[
15,
16,
1
],
"TypeSynonym"
Expand Down
4 changes: 2 additions & 2 deletions tests/parser/success/templateB.json
Expand Up @@ -4,10 +4,10 @@
[
7,
{
"in_ca": "Bool",
"name": "Text",
"value": "Double",
"taxed_value": "Double",
"in_ca": "Bool"
"value": "Double"
}
],
[
Expand Down

0 comments on commit 471037f

Please sign in to comment.