RecordUpdateNoFieldsTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction core-record-update-form
Not translated into Lean for the mechanisation of the book: see why.
A record update with no fields, `{ r | }`, is rejected.
A Standard Definition of Elm?, restriction core-record-update-form: in a record update
`{ var | exprow }` at least one expression row follows `|`. <https://elm-test-suite.netlify.app/standard/restrictions/core-record-update-form>Results
elm-0.19.1
passOutput
Compiling ...-- EXTRA COMMA -------------------------------- src/RecordUpdateNoFieldsTest.elm
I am partway through parsing a record, but I got stuck here:
19| { r | }
^
Trailing commas are not allowed in records. Try deleting the comma that appears
before this closing curly brace.
Note: If you are trying to define a record across multiple lines, I recommend
using this format:
{ name = "Alice"
, age = 42
, height = 1.75
}
Notice that each line starts with some indentation. Usually two or four spaces.
This is the stylistic convention in the Elm ecosystem.
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- PROBLEM IN RECORD -------------------------- src/RecordUpdateNoFieldsTest.elm
I am partway through parsing a record, but I got stuck here:
19| { r | }
^
I was expecting to see another record field defined next, so I am looking for a
name like userName or plantHeight.
Note: Field names must start with a lower-case letter. After that, you can use
any sequence of letters, numbers, and underscores.
Note: If you are trying to define a record across multiple lines, I recommend
using this format:
{ name = "Alice"
, age = 42
, height = 1.75
}
Notice that each line starts with some indentation. Usually two or four spaces.
This is the stylistic convention in the Elm ecosystem.
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- PROBLEM IN RECORD -------------------------- src/RecordUpdateNoFieldsTest.elm
I am partway through parsing a record, but I got stuck here:
19| { r | }
^
I was expecting to see another record field defined next, so I am looking for a
name like userName or plantHeight.
Note: Field names must start with a lower-case letter. After that, you can use
any sequence of letters, numbers, and underscores.
Note: If you are trying to define a record across multiple lines, I recommend
using this format:
{ name = "Alice"
, age = 42
, height = 1.75
}
Notice that each line starts with some indentation. Usually two or four spaces.
This is the stylistic convention in the Elm ecosystem.
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- PROBLEM IN RECORD -------------------------- src/RecordUpdateNoFieldsTest.elm
I am partway through parsing a record, but I got stuck here:
19| { r | }
^
I was expecting to see another record field defined next, so I am looking for a
name like userName or plantHeight.
Note: Field names must start with a lower-case letter. After that, you can use
any sequence of letters, numbers, and underscores.
Note: If you are trying to define a record across multiple lines, I recommend
using this format:
{ name = "Alice"
, age = 42
, height = 1.75
}
Notice that each line starts with some indentation. Usually two or four spaces.
This is the stylistic convention in the Elm ecosystem.
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/RecordUpdateNoFieldsTest] in its title.
Source
The -- CHECK: lines give the expected output.
module RecordUpdateNoFieldsTest exposing (main)
{-| A record update with no fields, `{ r | }`, is rejected.
A Standard Definition of Elm?, restriction core-record-update-form: in a record update
`{ var | exprow }` at least one expression row follows `|`. <https://elm-test-suite.netlify.app/standard/restrictions/core-record-update-form>
-}
-- TAGS: elm-spec, core-record-update-form
-- COMPILE-ERROR: a record update without fields
-- CHECK: {{-- [A-Z ]+ -}}
import Html
update : { key : Int } -> { key : Int }
update r =
{ r | }
main =
let
_ =
Debug.log "key" (update { key = 1 }).key
in
Html.text "done"
Lean translation
No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Static semantics: expected to be rejected, and eco's parser rejects it too. See the Lean mechanisation for which tests are in Lean, and why.