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

Referencing a variable before assigned compiles correctly, causes runtime JS errors #700

Closed
gak opened this Issue Aug 26, 2016 · 3 comments

Comments

Projects
None yet
5 participants
@gak

gak commented Aug 26, 2016

An example:

import Html exposing (text)
import String


main =
    let
        broken =
            if String.isEmpty broken then
                "a"
            else
                "b"
    in
        text broken

I tried a few String operations on broken with similar results.

Also interestingly enough, if broken == "hello" then works without an issue.

The error when running through elm-reactor is:

Runtime.elm:3806
Uncaught TypeError: Cannot read property 'length' of undefined
isEmpty @ Runtime.elm:3806
(anonymous function) @ Runtime.elm:7411
(anonymous function) @ Runtime.elm:7413
(anonymous function) @ Runtime.elm:7448

Runtime.elm:10
Uncaught TypeError: runElmProgram is not a function
(anonymous function) @ Runtime.elm:10

elm-package.json:

{
    "version": "1.0.0",
    "summary": "helpful summary of your project, less than 80 characters",
    "repository": "https://github.com/user/project.git",
    "license": "BSD3",
    "source-directories": [
        "."
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.5 <= v < 5.0.0",
        "elm-lang/html": "1.1.0 <= v < 2.0.0"
    },
    "elm-version": "0.17.0 <= v < 0.18.0"
}

Happens in Chrome and Firefox.
ProductName: Mac OS X
ProductVersion: 10.11.5
BuildVersion: 15F34

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Aug 26, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Aug 26, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@gak gak changed the title from Referencing a variable before declared compiles correctly, causes runtime JS errors to Referencing a variable before assigned compiles correctly, causes runtime JS errors Aug 26, 2016

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
Contributor

jvoigtlaender commented Aug 26, 2016

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Aug 29, 2016

Member

@jvoigtlaender and @lukewestby, it's totally fine to close duplicates like this. Better to tell people to follow the root one.

Member

evancz commented Aug 29, 2016

@jvoigtlaender and @lukewestby, it's totally fine to close duplicates like this. Better to tell people to follow the root one.

@evancz evancz closed this Aug 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment