Skip to content

Commit 1b4df1f

Browse files
committed
Remove optional documentation for LetFunction
1 parent 7ab96e7 commit 1b4df1f

File tree

6 files changed

+21
-36
lines changed

6 files changed

+21
-36
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@
4444
- Renamed `isOperatorApplication` to `isOperation`
4545
- Renamed `RecordExpr` to `Record`
4646
- Renamed `CaseExpression` to `Case`
47-
- Renamed `LetExpression` to `Let`
47+
- `LetExpression`
48+
- Renamed `LetExpression` to `Let`
49+
- Changed `LetFunction` so that it doesn't take an optional documentation, as that is invalid syntax.
4850
- Renamed `GLSLExpression` to `GLSL`
4951
- `UnitExpr` -> `TupleExpression []`
5052
- `ParenthesizedExpression x` -> `TupleExpression [ x ]`

src/Elm/Parser/Expression.elm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,7 @@ letFunction =
756756
, syntax =
757757
Node { start = startNameStart, end = expressionRange.end }
758758
(LetFunction
759-
{ documentation = Nothing
760-
, signature = Nothing
759+
{ signature = Nothing
761760
, declaration =
762761
Node { start = startNameStart, end = expressionRange.end }
763762
{ name = startNameNode
@@ -780,8 +779,7 @@ letFunction =
780779
, syntax =
781780
Node { start = startNameStart, end = expressionRange.end }
782781
(LetFunction
783-
{ documentation = Nothing
784-
, signature = Just (Node.combine Signature startNameNode signature.typeAnnotation)
782+
{ signature = Just (Node.combine Signature startNameNode signature.typeAnnotation)
785783
, declaration =
786784
Node { start = implementationNameRange.start, end = expressionRange.end }
787785
{ name = signature.implementationName

src/Elm/Syntax/Expression.elm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ type alias LetBlock =
140140
{-| Union type for all possible declarations in a let block
141141
-}
142142
type LetDeclaration
143-
= LetFunction Function
143+
= LetFunction { signature : Maybe (Node Signature), declaration : Node FunctionImplementation }
144144
| LetDestructuring (Node DestructurePattern) (Node Expression)
145145

146146

tests/Elm/Parser/DeclarationsTests.elm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ foo = bar"""
9292
{ declarations =
9393
[ Node { start = { row = 3, column = 5 }, end = { row = 5, column = 18 } }
9494
(LetFunction
95-
{ documentation = Nothing
96-
, signature = Nothing
95+
{ signature = Nothing
9796
, declaration =
9897
Node { start = { row = 3, column = 5 }, end = { row = 5, column = 18 } }
9998
{ name = Node { start = { row = 3, column = 5 }, end = { row = 3, column = 6 } } "y"
@@ -114,8 +113,7 @@ foo = bar"""
114113
)
115114
, Node { start = { row = 6, column = 5 }, end = { row = 6, column = 10 } }
116115
(LetFunction
117-
{ documentation = Nothing
118-
, signature = Nothing
116+
{ signature = Nothing
119117
, declaration =
120118
Node { start = { row = 6, column = 5 }, end = { row = 6, column = 10 } }
121119
{ name = Node { start = { row = 6, column = 5 }, end = { row = 6, column = 6 } } "a"
@@ -176,8 +174,7 @@ foo = bar"""
176174
{ declarations =
177175
[ Node { start = { row = 3, column = 3 }, end = { row = 3, column = 8 } }
178176
(LetFunction
179-
{ documentation = Nothing
180-
, signature = Nothing
177+
{ signature = Nothing
181178
, declaration =
182179
Node { start = { row = 3, column = 3 }, end = { row = 3, column = 8 } }
183180
{ name = Node { start = { row = 3, column = 3 }, end = { row = 3, column = 4 } } "b"

tests/Elm/Parser/FileTests.elm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ letWhitespace = let
276276
{ declarations =
277277
[ Node { start = { row = 5, column = 19 }, end = { row = 5, column = 26 } }
278278
(LetFunction
279-
{ documentation = Nothing
280-
, signature = Nothing
279+
{ signature = Nothing
281280
, declaration =
282281
Node { start = { row = 5, column = 19 }, end = { row = 5, column = 26 } }
283282
{ name = Node { start = { row = 5, column = 19 }, end = { row = 5, column = 20 } } "b"

tests/Elm/Parser/LetExpressionTests.elm

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ all =
2525
{ declarations =
2626
[ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 12 } }
2727
(LetFunction
28-
{ documentation = Nothing
29-
, signature = Nothing
28+
{ signature = Nothing
3029
, declaration =
3130
Node { start = { row = 2, column = 3 }, end = { row = 2, column = 12 } }
3231
{ name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "foo"
@@ -37,8 +36,7 @@ all =
3736
)
3837
, Node { start = { row = 4, column = 3 }, end = { row = 4, column = 13 } }
3938
(LetFunction
40-
{ documentation = Nothing
41-
, signature = Nothing
39+
{ signature = Nothing
4240
, declaration =
4341
Node { start = { row = 4, column = 3 }, end = { row = 4, column = 13 } }
4442
{ name = Node { start = { row = 4, column = 3 }, end = { row = 4, column = 7 } } "john"
@@ -64,8 +62,7 @@ all =
6462
{ declarations =
6563
[ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
6664
(LetFunction
67-
{ documentation = Nothing
68-
, signature = Nothing
65+
{ signature = Nothing
6966
, declaration =
7067
Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
7168
{ name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "bar"
@@ -106,8 +103,7 @@ all =
106103
{ declarations =
107104
[ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
108105
(LetFunction
109-
{ documentation = Nothing
110-
, signature = Nothing
106+
{ signature = Nothing
111107
, declaration =
112108
Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } }
113109
{ name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "bar"
@@ -134,8 +130,7 @@ all =
134130
{ declarations =
135131
[ Node { start = { row = 2, column = 5 }, end = { row = 3, column = 12 } }
136132
(LetFunction
137-
{ documentation = Nothing
138-
, signature =
133+
{ signature =
139134
Just
140135
(Node { start = { row = 2, column = 5 }, end = { row = 2, column = 14 } }
141136
{ name = Node { start = { row = 2, column = 5 }, end = { row = 2, column = 8 } } "bar"
@@ -172,8 +167,7 @@ all =
172167
{ declarations =
173168
[ Node { start = { row = 2, column = 5 }, end = { row = 5, column = 12 } }
174169
(LetFunction
175-
{ documentation = Nothing
176-
, signature =
170+
{ signature =
177171
Just
178172
(Node { start = { row = 2, column = 5 }, end = { row = 2, column = 14 } }
179173
{ name = Node { start = { row = 2, column = 5 }, end = { row = 2, column = 8 } } "bar"
@@ -228,8 +222,7 @@ all =
228222
{ declarations =
229223
[ Node { start = { row = 2, column = 11 }, end = { row = 2, column = 24 } }
230224
(LetFunction
231-
{ documentation = Nothing
232-
, signature = Nothing
225+
{ signature = Nothing
233226
, declaration =
234227
Node { start = { row = 2, column = 11 }, end = { row = 2, column = 24 } }
235228
{ name = Node { start = { row = 2, column = 11 }, end = { row = 2, column = 14 } } "bar"
@@ -353,8 +346,7 @@ all =
353346
{ declarations =
354347
[ Node { start = { row = 1, column = 5 }, end = { row = 1, column = 29 } }
355348
(LetFunction
356-
{ documentation = Nothing
357-
, signature = Nothing
349+
{ signature = Nothing
358350
, declaration =
359351
Node { start = { row = 1, column = 5 }, end = { row = 1, column = 29 } }
360352
{ name = Node { start = { row = 1, column = 5 }, end = { row = 1, column = 11 } } "indent"
@@ -385,8 +377,7 @@ all =
385377
{ declarations =
386378
[ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
387379
(LetFunction
388-
{ documentation = Nothing
389-
, signature = Nothing
380+
{ signature = Nothing
390381
, declaration =
391382
Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
392383
{ name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"
@@ -411,8 +402,7 @@ all =
411402
{ declarations =
412403
[ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
413404
(LetFunction
414-
{ documentation = Nothing
415-
, signature = Nothing
405+
{ signature = Nothing
416406
, declaration =
417407
Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
418408
{ name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"
@@ -437,8 +427,7 @@ all =
437427
{ declarations =
438428
[ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
439429
(LetFunction
440-
{ documentation = Nothing
441-
, signature = Nothing
430+
{ signature = Nothing
442431
, declaration =
443432
Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } }
444433
{ name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"

0 commit comments

Comments
 (0)