ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest
Tags:elm19-bug-fixerror-message
Issue: elm/error-message-catalog#372
A record update with no fields, `{ key | }`, is reported as an EXTRA COMMA, although the
program has no comma at all.
<https://github.com/elm/error-message-catalog/issues/372>
Elm 0.19.1 reports `-- EXTRA COMMA` and says "Try deleting the comma that appears before this
closing curly brace". The program is still wrong (a record update needs a field), but the
report must not blame a comma that does not exist.
Fixed in Elm 0.19.2.Results
elm-0.19.1
failUnexpected pattern (CHECK-NOT): -- EXTRA COMMA
--- compiler output ---
Compiling ...-- EXTRA COMMA ---- src/ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest.elm
I am partway through parsing a record, but I got stuck here:
26| { key | }
^
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/ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest.elm
I am partway through parsing a record, but I got stuck here:
26| { key | }
^
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/ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest.elm
I am partway through parsing a record, but I got stuck here:
26| { key | }
^
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/ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest.elm
I am partway through parsing a record, but I got stuck here:
26| { key | }
^
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-error-catalogue/ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ErrorMessagesIssue372EmptyRecordUpdateExtraCommaTest exposing (main)
{-| A record update with no fields, `{ key | }`, is reported as an EXTRA COMMA, although the
program has no comma at all.
<https://github.com/elm/error-message-catalog/issues/372>
Elm 0.19.1 reports `-- EXTRA COMMA` and says "Try deleting the comma that appears before this
closing curly brace". The program is still wrong (a record update needs a field), but the
report must not blame a comma that does not exist.
Fixed in Elm 0.19.2.
-}
-- TAGS: elm19-bug-fix, error-message
-- COMPILE-ERROR: record update without fields
-- CHECK: {{-- [A-Z ]+ -}}
-- CHECK-NOT: -- EXTRA COMMA
-- CHECK-NOT: deleting the comma
import Html exposing (text)
g key =
{ key | }
main =
text "done"