Skip to content

Compiler gives an error on destructuring a non existent record field #1748

Open
@rl-king

Description

@rl-king

Error

./elm make --debug src/Main.elm --output dist/elm.js
elm: ./Data/Vector/Generic/Mutable.hs:703 (modify): index out of bounds (3,3)
CallStack (from HasCallStack):
  error, called at ./Data/Vector/Internal/Check.hs:87:5 in vector-0.12.0.1-4FlkEWKNqrgLl7wn5Cpq3g:Data.Vector.Internal.Check
elm: thread blocked indefinitely in an MVar operation
make: *** [all] Error 1

SSCCE

module Main exposing (..)

import Browser
import Html exposing (..)


main : Program () { window : Int } msg
main =
    Browser.sandbox
        { init = 1
        , view = view
        , update = \_ model -> model
        }


foo : Float
foo =
    0


bar : { window : Int } -> Float
bar model =
    1


view ({ iDontExist } as model) =
    let
        _ =
            foo iDontExist <| bar model
    in
    Html.text ""

Notes

  • Adding a type annotation to the view function makes the error go away

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions