guida-lang/compiler

fails to keep order of destructs

Closed this issue · 0 comments

Given the following code:

import Html exposing (text)


fn1 : { foo : String, bar : String } -> String
fn1 { foo, bar } =
    foo ++ bar


main =
    text (fn1 { foo = "He", bar = "llo!" })

The generated code will show the following diff:

diff --git a/examples/index.html b/examples/index.html
index 3bb33235..02d296e3 100644
--- a/examples/index.html
+++ b/examples/index.html
@@ -4434,8 +4434,8 @@ var $elm$virtual_dom$VirtualDom$toHandlerInt = function (handler) {
 	}
 };
 var $author$project$Hello$fn1 = function (_v0) {
-	var foo = _v0.foo;
 	var bar = _v0.bar;
+	var foo = _v0.foo;
 	return _Utils_ap(foo, bar);
 };
 var $elm$virtual_dom$VirtualDom$text = _VirtualDom_text;