Elm Exactly
Results / elm /

BadTupleATupleOfFourTest

Tags:elm19-compile-errorelm-spec

Checks, in A Standard Definition of Elm?:figure core-grammar-expressionsrule s-atexp-tuple

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 four-element tuple is rejected with a BAD TUPLE error.

Elm tuples have at most three elements; `testValue` is `( 1, 2, 3, 4 )`.

Results

elm-0.19.1

pass
Output
Compiling ...-- BAD TUPLE ---------------------------------- src/BadTupleATupleOfFourTest.elm

I only accept tuples with two or three items. This has too many:

15|     ( 1, 2, 3, 4 )
        ^^^^^^^^^^^^^^
I recommend switching to records. Each item will be named, and you can use the
`point.x` syntax to access them.

Note: Read <https://elm-lang.org/0.19.1/tuples> for more comprehensive advice on
working with large chunks of data in Elm.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- BAD TUPLE ---------------------------------- src/BadTupleATupleOfFourTest.elm

I only accept tuples with two or three items. This has too many:

15|     ( 1, 2, 3, 4 )
        ^^^^^^^^^^^^^^
I recommend switching to records. Each item will be named, and you can use the
`point.x` syntax to access them.

Note: Read <https://elm-lang.org/0.19.2/tuples> for more comprehensive advice on
working with large chunks of data in Elm.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- BAD TUPLE ---------------------------------- src/BadTupleATupleOfFourTest.elm

I only accept tuples with two or three items. This has too many:

15|     ( 1, 2, 3, 4 )
        ^^^^^^^^^^^^^^
I recommend switching to records. Each item will be named, and you can use the
`point.x` syntax to access them.

Note: Read <https://elm-lang.org/0.19.3/tuples> for more comprehensive advice on
working with large chunks of data in Elm.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- BAD TUPLE ---------------------------------- src/BadTupleATupleOfFourTest.elm

I only accept tuples with two or three items. This has too many:

15|     ( 1, 2, 3, 4 )
        ^^^^^^^^^^^^^^
I recommend switching to records. Each item will be named, and you can use the
`point.x` syntax to access them.

Note: Read <https://elm-lang.org/0.19.3/tuples> for more comprehensive advice on
working with large chunks of data in Elm.

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module BadTupleATupleOfFourTest exposing (..)
{-| A four-element tuple is rejected with a BAD TUPLE error.
Elm tuples have at most three elements; `testValue` is `( 1, 2, 3, 4 )`.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, fig:core-grammar-expressions, s-atexp-tuple
-- COMPILE-ERROR: BAD TUPLE, a tuple of four
-- CHECK: -- BAD TUPLE -
testValue =
( 1, 2, 3, 4 )

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 the translator's front end refuses it: it breaks a restriction on characters, tokens and layout, which Lean does not model. See the Lean mechanisation for which tests are in Lean, and why.