HeaderExposesConstructorByNameTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction modules-header-exposing
Not translated into Lean for the mechanisation of the book: see why.
A header cannot expose a constructor by name. A Standard Definition of Elm?, restriction modules-header-exposing: an item `T` of a header names a type, and the constructors of a custom type are exposed only by `T(..)` or `(..)`. `Two` is a constructor of `T`, not a type. <https://elm-test-suite.netlify.app/standard/restrictions/modules-header-exposing>
Results
elm-0.19.1
passOutput
Compiling ...-- UNKNOWN EXPORT ------------------- src/HeaderExposesConstructorByNameTest.elm You are trying to expose a type named `Two` but I cannot find its definition. Maybe you want T instead? Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- UNKNOWN EXPORT ------------------- src/HeaderExposesConstructorByNameTest.elm You are trying to expose a type named `Two` but I cannot find its definition. Maybe you want T instead? Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- UNKNOWN EXPORT ------------------- src/HeaderExposesConstructorByNameTest.elm
You are trying to expose a type named `Two` but I cannot find its definition.
1| module HeaderExposesConstructorByNameTest exposing (Two, main)
^^^
Maybe you want T instead?
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- UNKNOWN EXPORT ------------------- src/HeaderExposesConstructorByNameTest.elm
You are trying to expose a type named `Two` but I cannot find its definition.
1| module HeaderExposesConstructorByNameTest exposing (Two, main)
^^^
Maybe you want T instead?
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/HeaderExposesConstructorByNameTest] in its title.
Source
The -- CHECK: lines give the expected output.
module HeaderExposesConstructorByNameTest exposing (Two, main)
{-| A header cannot expose a constructor by name.
A Standard Definition of Elm?, restriction modules-header-exposing: an item `T` of a header names a
type, and the constructors of a custom type are exposed only by `T(..)` or `(..)`. `Two` is a
constructor of `T`, not a type. <https://elm-test-suite.netlify.app/standard/restrictions/modules-header-exposing>
-}
-- TAGS: elm-spec, modules-header-exposing
-- COMPILE-ERROR: a header exposing a constructor by name
-- CHECK: {{-- [A-Z ]+ -}}
import Html
type T
= One
| Two
main =
Html.text
(case Two of
One ->
"one"
Two ->
"two"
)
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_HeaderExposesConstructorByNameTest, in StandardElmMech/Certs/). The program breaks a syntactic restriction, which the kernel checks on its syntax tree; no type inference is involved (Stat.not_legal_of_syn): res:modules-header-exposing. It holds for every derivation, with no hypothesis about principality.