guida-lang / compiler

Guida is a functional programming language that builds upon the solid foundation of Elm, offering backward compatibility with all existing Elm 0.19.1 projects
https://guida-lang.org
Other
41 stars 2 forks source link

fails to keep order of destructs #16

Closed decioferreira closed 2 months ago

decioferreira commented 2 months ago

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;