ImportedModuleTypeErrorTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:rule p-program
Not translated into Lean for the mechanisation of the book: see why.
A program whose imported module has a type error is rejected as a whole. A Standard Definition of Elm?, rule p-program: a program is elaborated as a whole before any part of it is evaluated, so when one module fails to elaborate nothing is evaluated. `ImportedModuleTypeErrorHelper` adds a String to an Int. <https://elm-test-suite.netlify.app/standard/rules/p-program>
Results
elm-0.19.1
passOutput
Compiling ...-- TYPE MISMATCH ------------------------- src/ImportedModuleTypeErrorHelper.elm
I cannot do addition with String values like this one:
10| 1 + "one"
^^^^^
The (+) operator only works with Int and Float values.
Hint: Switch to the (++) operator to append strings!
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- TYPE MISMATCH ------------------------- src/ImportedModuleTypeErrorHelper.elm
I cannot do addition with String values like this one:
10| 1 + "one"
^^^^^
The (+) operator only works with Int and Float values.
Hint: Switch to the (++) operator to append strings!
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- TYPE MISMATCH ------------------------- src/ImportedModuleTypeErrorHelper.elm
I cannot do addition with String values like this one:
10| 1 + "one"
^^^^^
The (+) operator only works with Int and Float values.
Hint: Switch to the (++) operator to append strings!
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- TYPE MISMATCH ------------------------- src/ImportedModuleTypeErrorHelper.elm
I cannot do addition with String values like this one:
10| 1 + "one"
^^^^^
The (+) operator only works with Int and Float values.
Hint: Switch to the (++) operator to append strings!
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/ImportedModuleTypeErrorTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ImportedModuleTypeErrorTest exposing (main)
{-| A program whose imported module has a type error is rejected as a whole.
A Standard Definition of Elm?, rule p-program: a program is elaborated as a whole before any part
of it is evaluated, so when one module fails to elaborate nothing is evaluated.
`ImportedModuleTypeErrorHelper` adds a String to an Int. <https://elm-test-suite.netlify.app/standard/rules/p-program>
-}
-- TAGS: elm-spec, p-program
-- COMPILE-ERROR: a type error in an imported module
-- CHECK: {{-- [A-Z ]+ -}}
import Html
import ImportedModuleTypeErrorHelper
main =
let
_ =
Debug.log "ran" True
_ =
Debug.log "value" ImportedModuleTypeErrorHelper.value
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_ImportedModuleTypeErrorTest, in StandardElmMech/Certs/). The kernel finds a core of the program's typing constraints that has no solution, so no derivation types it (core refutation, plan step 11) (Stat.not_legal_of_coreRefutes). It holds for every derivation, with no hypothesis about principality.