ImportUnknownOperatorTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:rule sm-item-op
Not translated into Lean for the mechanisation of the book: see why.
An import cannot name an operator its module does not have. A Standard Definition of Elm?, rule sm-item-op: the item `(op)` elaborates only if the module declares the operator. `Basics` has no `<+>`. <https://elm-test-suite.netlify.app/standard/rules/sm-item-op>
Results
elm-0.19.1
passOutput
Compiling ...-- BAD IMPORT -------------------------------- src/ImportUnknownOperatorTest.elm
The `Basics` module does not expose `<+>`:
14| import Basics exposing ((<+>))
^^^^^
These names seem close though:
&&
*
+
++
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- BAD IMPORT -------------------------------- src/ImportUnknownOperatorTest.elm
The `Basics` module does not expose `<+>`:
14| import Basics exposing ((<+>))
^^^^^
These names seem close though:
&&
*
+
++
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- BAD IMPORT -------------------------------- src/ImportUnknownOperatorTest.elm
The `Basics` module does not expose `<+>`:
14| import Basics exposing ((<+>))
^^^^^
These names seem close though:
*
+
-
/
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- BAD IMPORT -------------------------------- src/ImportUnknownOperatorTest.elm
The `Basics` module does not expose `<+>`:
14| import Basics exposing ((<+>))
^^^^^
These names seem close though:
*
+
-
/
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/ImportUnknownOperatorTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ImportUnknownOperatorTest exposing (main)
{-| An import cannot name an operator its module does not have.
A Standard Definition of Elm?, rule sm-item-op: the item `(op)` elaborates only if the module
declares the operator. `Basics` has no `<+>`. <https://elm-test-suite.netlify.app/standard/rules/sm-item-op>
-}
-- TAGS: elm-spec, sm-item-op
-- COMPILE-ERROR: an import of an operator the module does not have
-- CHECK: {{-- [A-Z ]+ -}}
import Basics exposing ((<+>))
import Html
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_ImportUnknownOperatorTest, in StandardElmMech/Certs/). An import of the program does not elaborate in the test basis (Stat.not_legal_of_imports). It holds for every derivation, with no hypothesis about principality.