HeaderExposesTypeTwiceTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction modules-exposing-distinct
Not translated into Lean for the mechanisation of the book: see why.
A header cannot expose a type both closed and with its constructors. A Standard Definition of Elm?, restriction modules-exposing-distinct: no two items of the exposing list of a header may have the same identifier, so `T` and `T(..)` do not both occur. <https://elm-test-suite.netlify.app/standard/restrictions/modules-exposing-distinct>
Results
elm-0.19.1
passOutput
Compiling ...-- REDUNDANT EXPORT ------------------------- src/HeaderExposesTypeTwiceTest.elm
You are trying to expose `T` multiple times!
1| module HeaderExposesTypeTwiceTest exposing (T, T(..), main)
^ ^
Remove one of them and you should be all set!
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- REDUNDANT EXPORT ------------------------- src/HeaderExposesTypeTwiceTest.elm
You are trying to expose `T` multiple times!
0| module HeaderExposesTypeTwiceTest exposing (T, T(..), main)
^ ^
Remove one of them and you should be all set!
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- REDUNDANT EXPORT ------------------------- src/HeaderExposesTypeTwiceTest.elm
You are trying to expose `T` multiple times!
0| module HeaderExposesTypeTwiceTest exposing (T, T(..), main)
^ ^
Remove one of them and you should be all set!
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- REDUNDANT EXPORT ------------------------- src/HeaderExposesTypeTwiceTest.elm
You are trying to expose `T` multiple times!
0| module HeaderExposesTypeTwiceTest exposing (T, T(..), main)
^ ^
Remove one of them and you should be all set!
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/HeaderExposesTypeTwiceTest] in its title.
Source
The -- CHECK: lines give the expected output.
module HeaderExposesTypeTwiceTest exposing (T, T(..), main)
{-| A header cannot expose a type both closed and with its constructors.
A Standard Definition of Elm?, restriction modules-exposing-distinct: no two items of the exposing
list of a header may have the same identifier, so `T` and `T(..)` do not both occur.
<https://elm-test-suite.netlify.app/standard/restrictions/modules-exposing-distinct>
-}
-- TAGS: elm-spec, modules-exposing-distinct
-- COMPILE-ERROR: a header exposing T and T(..)
-- CHECK: {{-- [A-Z ]+ -}}
import Html
type T
= T Int
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_HeaderExposesTypeTwiceTest, 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-exposing-distinct. It holds for every derivation, with no hypothesis about principality.