Elm Exactly
Results / elm /

ImportUnexposedValueTest

Tags:elm-spec

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

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 value its module's header does not expose cannot be used, even qualified.

A Standard Definition of Elm?, rule sm-header: a module's interface is what its header exposes.
`ModuleExposingHelper` declares `hidden` but does not expose it. <https://elm-test-suite.netlify.app/standard/rules/sm-header>

Results

elm-0.19.1

pass
Output
Compiling ...-- NAMING ERROR ------------------------------- src/ImportUnexposedValueTest.elm

I cannot find a `ModuleExposingHelper.hidden` variable:

21|             Debug.log "hidden" ModuleExposingHelper.hidden
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The `ModuleExposingHelper` module does not expose a `hidden` variable. These
names seem close though:

    ModuleExposingHelper.double
    ModuleExposingHelper.makeClosed
    ModuleExposingHelper.makeShape
    ModuleExposingHelper.exposedCount

Hint: Read <https://elm-lang.org/0.19.1/imports> to see how `import`
declarations work in Elm.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- NAMING ERROR ------------------------------- src/ImportUnexposedValueTest.elm

I cannot find a `ModuleExposingHelper.hidden` variable:

21|             Debug.log "hidden" ModuleExposingHelper.hidden
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The `ModuleExposingHelper` module does not expose a `hidden` variable. These
names seem close though:

    ModuleExposingHelper.double
    ModuleExposingHelper.makeClosed
    ModuleExposingHelper.makeShape
    ModuleExposingHelper.exposedCount

Hint: Read <https://elm-lang.org/0.19.2/imports> to see how `import`
declarations work in Elm.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- NAMING ERROR ------------------------------- src/ImportUnexposedValueTest.elm

I cannot find a `ModuleExposingHelper.hidden` variable:

21|             Debug.log "hidden" ModuleExposingHelper.hidden
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The `ModuleExposingHelper` module does not expose a `hidden` variable. These
names seem close though:

    ModuleExposingHelper.double
    ModuleExposingHelper.makeShape
    ModuleExposingHelper.makeClosed
    ModuleExposingHelper.exposedCount

Hint: Read <https://elm-lang.org/0.19.3/imports> to see how `import`
declarations work in Elm.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- NAMING ERROR ------------------------------- src/ImportUnexposedValueTest.elm

I cannot find a `ModuleExposingHelper.hidden` variable:

21|             Debug.log "hidden" ModuleExposingHelper.hidden
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The `ModuleExposingHelper` module does not expose a `hidden` variable. These
names seem close though:

    ModuleExposingHelper.double
    ModuleExposingHelper.makeShape
    ModuleExposingHelper.makeClosed
    ModuleExposingHelper.exposedCount

Hint: Read <https://elm-lang.org/0.19.3/imports> to see how `import`
declarations work in Elm.

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ImportUnexposedValueTest exposing (main)
{-| A value its module's header does not expose cannot be used, even qualified.
A Standard Definition of Elm?, rule sm-header: a module's interface is what its header exposes.
`ModuleExposingHelper` declares `hidden` but does not expose it. <https://elm-test-suite.netlify.app/standard/rules/sm-header>
-}
-- TAGS: elm-spec, sm-header
-- COMPILE-ERROR: a use of a value the imported module does not expose
-- CHECK: {{-- [A-Z ]+ -}}
import Html
import ModuleExposingHelper
main =
let
_ =
Debug.log "hidden" ModuleExposingHelper.hidden
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. 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_ImportUnexposedValueTest, 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.