diff --git a/CHANGELOG.md b/CHANGELOG.md index d33f78490..535345260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,7 +44,9 @@ - Renamed `isOperatorApplication` to `isOperation` - Renamed `RecordExpr` to `Record` - Renamed `CaseExpression` to `Case` - - Renamed `LetExpression` to `Let` + - `LetExpression` + - Renamed `LetExpression` to `Let` + - Changed `LetFunction` so that it doesn't take an optional documentation, as that is invalid syntax. - Renamed `GLSLExpression` to `GLSL` - `UnitExpr` -> `TupleExpression []` - `ParenthesizedExpression x` -> `TupleExpression [ x ]` diff --git a/src/Elm/Parser/Expression.elm b/src/Elm/Parser/Expression.elm index 44415be34..220959e1b 100644 --- a/src/Elm/Parser/Expression.elm +++ b/src/Elm/Parser/Expression.elm @@ -756,8 +756,7 @@ letFunction = , syntax = Node { start = startNameStart, end = expressionRange.end } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = startNameStart, end = expressionRange.end } { name = startNameNode @@ -780,8 +779,7 @@ letFunction = , syntax = Node { start = startNameStart, end = expressionRange.end } (LetFunction - { documentation = Nothing - , signature = Just (Node.combine Signature startNameNode signature.typeAnnotation) + { signature = Just (Node.combine Signature startNameNode signature.typeAnnotation) , declaration = Node { start = implementationNameRange.start, end = expressionRange.end } { name = signature.implementationName diff --git a/src/Elm/Syntax/Expression.elm b/src/Elm/Syntax/Expression.elm index 5f20bd647..8c1e1b464 100644 --- a/src/Elm/Syntax/Expression.elm +++ b/src/Elm/Syntax/Expression.elm @@ -140,7 +140,7 @@ type alias LetBlock = {-| Union type for all possible declarations in a let block -} type LetDeclaration - = LetFunction Function + = LetFunction { signature : Maybe (Node Signature), declaration : Node FunctionImplementation } | LetDestructuring (Node DestructurePattern) (Node Expression) diff --git a/tests/Elm/Parser/DeclarationsTests.elm b/tests/Elm/Parser/DeclarationsTests.elm index 4f9cb4e53..31e44a2bb 100644 --- a/tests/Elm/Parser/DeclarationsTests.elm +++ b/tests/Elm/Parser/DeclarationsTests.elm @@ -92,8 +92,7 @@ foo = bar""" { declarations = [ Node { start = { row = 3, column = 5 }, end = { row = 5, column = 18 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 3, column = 5 }, end = { row = 5, column = 18 } } { name = Node { start = { row = 3, column = 5 }, end = { row = 3, column = 6 } } "y" @@ -114,8 +113,7 @@ foo = bar""" ) , Node { start = { row = 6, column = 5 }, end = { row = 6, column = 10 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 6, column = 5 }, end = { row = 6, column = 10 } } { name = Node { start = { row = 6, column = 5 }, end = { row = 6, column = 6 } } "a" @@ -176,8 +174,7 @@ foo = bar""" { declarations = [ Node { start = { row = 3, column = 3 }, end = { row = 3, column = 8 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 3, column = 3 }, end = { row = 3, column = 8 } } { name = Node { start = { row = 3, column = 3 }, end = { row = 3, column = 4 } } "b" diff --git a/tests/Elm/Parser/FileTests.elm b/tests/Elm/Parser/FileTests.elm index 412b39c54..fbb3016c8 100644 --- a/tests/Elm/Parser/FileTests.elm +++ b/tests/Elm/Parser/FileTests.elm @@ -279,8 +279,7 @@ letWhitespace = let { declarations = [ Node { start = { row = 5, column = 19 }, end = { row = 5, column = 26 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 5, column = 19 }, end = { row = 5, column = 26 } } { name = Node { start = { row = 5, column = 19 }, end = { row = 5, column = 20 } } "b" diff --git a/tests/Elm/Parser/LetExpressionTests.elm b/tests/Elm/Parser/LetExpressionTests.elm index ba3323cc2..2d7b87ab1 100644 --- a/tests/Elm/Parser/LetExpressionTests.elm +++ b/tests/Elm/Parser/LetExpressionTests.elm @@ -25,8 +25,7 @@ all = { declarations = [ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 12 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 12 } } { name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "foo" @@ -37,8 +36,7 @@ all = ) , Node { start = { row = 4, column = 3 }, end = { row = 4, column = 13 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 4, column = 3 }, end = { row = 4, column = 13 } } { name = Node { start = { row = 4, column = 3 }, end = { row = 4, column = 7 } } "john" @@ -64,8 +62,7 @@ all = { declarations = [ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } } { name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "bar" @@ -106,8 +103,7 @@ all = { declarations = [ Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 10 } } { name = Node { start = { row = 2, column = 3 }, end = { row = 2, column = 6 } } "bar" @@ -134,8 +130,7 @@ all = { declarations = [ Node { start = { row = 2, column = 5 }, end = { row = 3, column = 12 } } (LetFunction - { documentation = Nothing - , signature = + { signature = Just (Node { start = { row = 2, column = 5 }, end = { row = 2, column = 14 } } { name = Node { start = { row = 2, column = 5 }, end = { row = 2, column = 8 } } "bar" @@ -172,8 +167,7 @@ all = { declarations = [ Node { start = { row = 2, column = 5 }, end = { row = 5, column = 12 } } (LetFunction - { documentation = Nothing - , signature = + { signature = Just (Node { start = { row = 2, column = 5 }, end = { row = 2, column = 14 } } { name = Node { start = { row = 2, column = 5 }, end = { row = 2, column = 8 } } "bar" @@ -228,8 +222,7 @@ all = { declarations = [ Node { start = { row = 2, column = 11 }, end = { row = 2, column = 24 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 11 }, end = { row = 2, column = 24 } } { name = Node { start = { row = 2, column = 11 }, end = { row = 2, column = 14 } } "bar" @@ -353,8 +346,7 @@ all = { declarations = [ Node { start = { row = 1, column = 5 }, end = { row = 1, column = 29 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 1, column = 5 }, end = { row = 1, column = 29 } } { name = Node { start = { row = 1, column = 5 }, end = { row = 1, column = 11 } } "indent" @@ -385,8 +377,7 @@ all = { declarations = [ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } } { name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a" @@ -411,8 +402,7 @@ all = { declarations = [ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } } { name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a" @@ -437,8 +427,7 @@ all = { declarations = [ Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } } (LetFunction - { documentation = Nothing - , signature = Nothing + { signature = Nothing , declaration = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 14 } } { name = Node { start = { row = 2, column = 9 }, end = { row = 2, column = 10 } } "a"