Elm Exactly
Results / elm /

StandardA1UnitPatternGapTest

Tags:elm19-bugelm-spec

Checks, in A Standard Definition of Elm?:restriction core-adjacent-items

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

elm-0.19.1 failelm-0.19.2 failelm-0.19.3 faillamdera-1.5.0 fail
The unit pattern is `()`, with nothing between the parentheses.

A Standard Definition of Elm?, ruling A1: unit is the two characters `()` in expressions, patterns
and types alike, so `( )` is not a pattern. <https://elm-test-suite.netlify.app/standard/restrictions/core-adjacent-items>

Elm 0.19.1 rejects `( )` as an expression or type but accepts it as a pattern.

Results

elm-0.19.1

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

    StandardA1UnitPatternGapTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.1/elm/out/StandardA1UnitPatternGapTest.js

elm-0.19.2

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

    StandardA1UnitPatternGapTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.2/elm/out/StandardA1UnitPatternGapTest.js

elm-0.19.3

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

    StandardA1UnitPatternGapTest ───> /home/runner/work/elm-test-suite/elm-test-suite/.work/elm-0.19.3/elm/out/StandardA1UnitPatternGapTest.js

lamdera-1.5.0

fail
compiled, but a compile error was expected
--- compiler output ---
Success! Compiled 1 module.

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StandardA1UnitPatternGapTest exposing (..)
{-| The unit pattern is `()`, with nothing between the parentheses.
A Standard Definition of Elm?, ruling A1: unit is the two characters `()` in expressions, patterns
and types alike, so `( )` is not a pattern. <https://elm-test-suite.netlify.app/standard/restrictions/core-adjacent-items>
Elm 0.19.1 rejects `( )` as an expression or type but accepts it as a pattern.
-}
-- TAGS: elm19-bug
-- TAGS: elm-spec, core-adjacent-items
-- COMPILE-ERROR: a unit pattern with a gap
-- CHECK: {{-- [A-Z ]+ -}}
import Html
f : () -> Int
f ( ) =
1
main =
let
_ =
Debug.log "f ()" (f ())
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 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.