Elm Exactly
Results / elm /

ImportAliasOpenItemTest

Tags:elm-spec

Checks, in A Standard Definition of Elm?:rule sm-item-opentype

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
An import cannot name a type alias with `(..)`.

A Standard Definition of Elm?, rule sm-item-opentype: the item `T(..)` elaborates only for a custom
type. `Point` is a record alias. <https://elm-test-suite.netlify.app/standard/rules/sm-item-opentype>

Results

elm-0.19.1

pass
Output
Compiling (1)-- BAD IMPORT ---------------------------------- src/ImportAliasOpenItemTest.elm

The `Point` type alias cannot be followed by (..) like this:

15| import ModuleExposingHelper exposing (Point(..))
                                                ^^
Remove the (..) and it should work.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling (1)-- BAD IMPORT ---------------------------------- src/ImportAliasOpenItemTest.elm

The `Point` type alias cannot be followed by (..) like this:

15| import ModuleExposingHelper exposing (Point(..))
                                                ^^
Remove the (..) and it should work.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling (1)-- BAD IMPORT ---------------------------------- src/ImportAliasOpenItemTest.elm

The `Point` type alias cannot be followed by (..) like this:

15| import ModuleExposingHelper exposing (Point(..))
                                                ^^
Remove the (..) and it should work.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- BAD IMPORT ---------------------------------- src/ImportAliasOpenItemTest.elm

The `Point` type alias cannot be followed by (..) like this:

15| import ModuleExposingHelper exposing (Point(..))
                                                ^^
Remove the (..) and it should work.

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ImportAliasOpenItemTest exposing (main)
{-| An import cannot name a type alias with `(..)`.
A Standard Definition of Elm?, rule sm-item-opentype: the item `T(..)` elaborates only for a custom
type. `Point` is a record alias. <https://elm-test-suite.netlify.app/standard/rules/sm-item-opentype>
-}
-- TAGS: elm-spec, sm-item-opentype
-- COMPILE-ERROR: an import of an alias with (..)
-- CHECK: {{-- [A-Z ]+ -}}
import Html
import ModuleExposingHelper exposing (Point(..))
main =
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. Lean has the program as written, in source syntax, and proves what the static semantics says of it (below). See the Lean mechanisation for which tests are in Lean, and why.

Static semantics: Lean proves that the program as written is not legal, so a compiler must reject it (refuse_elm_ImportAliasOpenItemTest, in StandardElmMech/Certs/). A name is out of scope (or a constructor pattern has the wrong arity) in every derivation (Stat.not_legal_of_scopeFailB). It holds for every derivation, with no hypothesis about principality.