Elm Exactly
Results / elm /

StandardA99RecordPatternRowRenameRejectedTest

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` is rejected.

A Standard Definition of Elm?, ruling A99: the bare pattern row `lab = var` is in the book's grammar
so that number specialisation can rename a row's variable, but no program may write it (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/StandardA99RecordPatternRowRenameRejectedTest.elm

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

19|         { n = m } =
                ^
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/StandardA99RecordPatternRowRenameRejectedTest.elm

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

19|         { n = m } =
                ^
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/StandardA99RecordPatternRowRenameRejectedTest.elm

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

19|         { n = m } =
                ^
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/StandardA99RecordPatternRowRenameRejectedTest.elm

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

19|         { n = m } =
                ^
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/StandardA99RecordPatternRowRenameRejectedTest] in its title.

Source

The -- CHECK: lines give the expected output.

module StandardA99RecordPatternRowRenameRejectedTest exposing (..)
{-| A record pattern row written `lab = var` is rejected.
A Standard Definition of Elm?, ruling A99: the bare pattern row `lab = var` is in the book's grammar
so that number specialisation can rename a row's variable, but no program may write it (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 = m } =
{ n = 1 }
in
m

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.