Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when used with myrho/elm-round #35

Open
hpate-triller opened this issue Jan 22, 2021 · 0 comments
Open

Crash when used with myrho/elm-round #35

hpate-triller opened this issue Jan 22, 2021 · 0 comments

Comments

@hpate-triller
Copy link

I noticed this when loading it in an app at work with myrho/elm-round. I created a small repo to reproduce it: https://github.com/hpate-triller/elm-optimize-level-2-round-bug

module Main exposing (main)

import Html
import Round


main =
    Html.text (Round.round 2 56.25)

It will crash at runtime with in this block, where it tries to call _v0.a.a.valueOf(), when this happens the str that is passed in is an empty string.

    var $myrho$elm_round$Round$round_a0 = F2(function (signed, str) {
        var _v0 = $elm$core$String$uncons(str);
        if (_v0.$ === "Nothing") {
            return false;
        }
        else {
            if ("5" === _v0.a.a.valueOf()) {
                if (_v0.a.b === "") {
                    var _v1 = _v0.a;
                    return !signed;
                }
                else {
                    var _v2 = _v0.a;
                    return true;
                }
            }
            else {
                var _v3 = _v0.a;
                var _int = _v3.a;
                return function (i) {
                    return ((i > 53) && signed) || ((i >= 53) && (!signed));
                }($elm$core$Char$toCode(_int));
            }
        }
    }), $myrho$elm_round$Round$round = $myrho$elm_round$Round$roundFun($myrho$elm_round$Round$round_a0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant