Elm Exactly
Results / elm /

StandardA99RecordPatternRowPunRejectedTest

Tags:elm19-compile-errorelm-spec

Checks, in A Standard Definition of Elm?:restriction core-pattern-row-label-only

Not translated into Lean for the mechanisation of the book: see why.

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
A record pattern row written `lab = var`, with the variable spelt as the label, is rejected.

A Standard Definition of Elm?, ruling A99: `{ n = n }` is the equivalent form of `{ n }`, but a
program may write only the derived form (restriction core-pattern-row-label-only). Elm 0.19.1
reports UNFINISHED RECORD PATTERN.
<https://elm-test-suite.netlify.app/standard/restrictions/core-pattern-row-label-only>

Results

elm-0.19.1

pass
Output
Compiling ...-- UNFINISHED RECORD PATTERN - src/StandardA99RecordPatternRowPunRejectedTest.elm

I was partway through parsing a record pattern, but I got stuck here:

19|         { n = n } =
                ^
I was expecting to see a closing curly brace next. Try adding a } here?

Hint: A record pattern looks like {x,y} or {name,age} where you list the field
names you want to access.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- UNFINISHED RECORD PATTERN - src/StandardA99RecordPatternRowPunRejectedTest.elm

I was partway through parsing a record pattern, but I got stuck here:

19|         { n = n } =
                ^
I was expecting to see a closing curly brace next. Try adding a } here?

Hint: A record pattern looks like {x,y} or {name,age} where you list the field
names you want to access.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- UNFINISHED RECORD PATTERN - src/StandardA99RecordPatternRowPunRejectedTest.elm

I was partway through parsing a record pattern, but I got stuck here:

19|         { n = n } =
                ^
I was expecting to see a closing curly brace next. Try adding a } here?

Hint: A record pattern looks like {x,y} or {name,age} where you list the field
names you want to access.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- UNFINISHED RECORD PATTERN - src/StandardA99RecordPatternRowPunRejectedTest.elm

I was partway through parsing a record pattern, but I got stuck here:

19|         { n = n } =
                ^
I was expecting to see a closing curly brace next. Try adding a } here?

Hint: A record pattern looks like {x,y} or {name,age} where you list the field
names you want to access.

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm/StandardA99RecordPatternRowPunRejectedTest] in its title.

Source

The -- CHECK: lines give the expected output.

module StandardA99RecordPatternRowPunRejectedTest exposing (..)
{-| A record pattern row written `lab = var`, with the variable spelt as the label, is rejected.
A Standard Definition of Elm?, ruling A99: `{ n = n }` is the equivalent form of `{ n }`, but a
program may write only the derived form (restriction core-pattern-row-label-only). Elm 0.19.1
reports UNFINISHED RECORD PATTERN.
<https://elm-test-suite.netlify.app/standard/restrictions/core-pattern-row-label-only>
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, core-pattern-row-label-only
-- COMPILE-ERROR: UNFINISHED RECORD PATTERN, a pattern row with `=`
-- CHECK: -- UNFINISHED RECORD PATTERN -
testValue =
let
{ n = n } =
{ n = 1 }
in
n

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.