on master help sign in
Fix #1535, order of defs matters!
3594701Evan Czaplicki
src/Parse/Expression.hs+3−3
@@ -489,11 +489,11 @@ let_ start =
489
489
490
490
491letHelp :: R.Position -> Int -> [Src.RawDef] -> R.Position -> SPos -> ExprParser
491letHelp :: R.Position -> Int -> [Src.RawDef] -> R.Position -> SPos -> ExprParser
492−letHelp start oldIndent defs end pos =
492+letHelp start oldIndent revDefs end pos =
493 oneOf
493 oneOf
494 [ do checkAligned pos
494 [ do checkAligned pos
495 (def, newEnd, newPos) <- definition
495 (def, newEnd, newPos) <- definition
496− letHelp start oldIndent (def:defs) newEnd newPos
496+ letHelp start oldIndent (def:revDefs) newEnd newPos
497
497
498 , do setIndent oldIndent
498 , do setIndent oldIndent
499 checkSpace pos
499 checkSpace pos
@@ -501,7 +501,7 @@ letHelp start oldIndent defs end pos =
501 popContext ()
501 popContext ()
502 spaces
502 spaces
503 (body, newEnd, newPos) <- expression
503 (body, newEnd, newPos) <- expression
504− let letExpr = A.at start end (Src.Let defs body)
504+ let letExpr = A.at start end (Src.Let (reverse revDefs) body)
505 return ( letExpr, newEnd, newPos )
505 return ( letExpr, newEnd, newPos )
506 ]
506 ]
507
507
tests/test-files/good-expected-js/Records/NonHomogeneousRecords.elm.js+1−1
@@ -1,6 +1,6 @@
1var _elm_lang$core$Main$bindFields = function (thing) {
1var _elm_lang$core$Main$bindFields = function (thing) {
2− var x = thing.x;
3 var y = thing.y;
2 var y = thing.y;
3+ var x = thing.x;
4 return thing;
4 return thing;
5};
5};
6var _elm_lang$core$Main$Thing = F2(
6var _elm_lang$core$Main$Thing = F2(
tests/test-files/good-expected-js/Soundness/IdAnnotated.elm.jsnew file+6
@@ -0,0 +1,6 @@
1+var _elm_lang$core$Main$myId = function () {
2+ var id = function (x) {
3+ return x;
4+ };
5+ return id;
6+}();