Elm Exactly
Results / elm /

QualifiedTypeNotExposedTest

Tags:elm-spec

Checks, in A Standard Definition of Elm?:rule s-ty-con

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 qualified type that its module does not expose is not a type: `List.Bar` is rejected.

A Standard Definition of Elm?, rule s-ty-con: a type construction elaborates only when its long
type constructor is bound in the context; the interface of `List` binds no type constructor, so
`List.Bar` is bound to nothing. <https://elm-test-suite.netlify.app/standard/rules/s-ty-con>

Results

elm-0.19.1

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

I cannot find a `List.Bar` type:

18| foo : List.Bar
          ^^^^^^^^
The `List` module does not expose a `Bar` type. These names seem close though:

    List
    Char.Char
    Char
    Int

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/QualifiedTypeNotExposedTest.elm

I cannot find a `List.Bar` type:

18| foo : List.Bar
          ^^^^^^^^
The `List` module does not expose a `Bar` type. These names seem close though:

    List
    Char.Char
    Char
    Int

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/QualifiedTypeNotExposedTest.elm

I cannot find a `List.Bar` type:

18| foo : List.Bar
          ^^^^^^^^
The `List` module does not expose a `Bar` type. These names seem close though:

    List
    Char.Char
    Int
    Sub

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/QualifiedTypeNotExposedTest.elm

I cannot find a `List.Bar` type:

18| foo : List.Bar
          ^^^^^^^^
The `List` module does not expose a `Bar` type. These names seem close though:

    List
    Char.Char
    Int
    Sub

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/QualifiedTypeNotExposedTest] in its title.

Source

The -- CHECK: lines give the expected output.

module QualifiedTypeNotExposedTest exposing (main)
{-| A qualified type that its module does not expose is not a type: `List.Bar` is rejected.
A Standard Definition of Elm?, rule s-ty-con: a type construction elaborates only when its long
type constructor is bound in the context; the interface of `List` binds no type constructor, so
`List.Bar` is bound to nothing. <https://elm-test-suite.netlify.app/standard/rules/s-ty-con>
-}
-- TAGS: elm-spec, s-ty-con
-- COMPILE-ERROR: a qualified type its module does not expose
-- CHECK: {{-- [A-Z ]+ -}}
import Html
foo : List.Bar
foo =
foo
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_QualifiedTypeNotExposedTest, 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-value-recursion. It holds for every derivation, with no hypothesis about principality.