NameClashTwoLetBindingsOfOneNameTest
Tags:elm19-compile-errorelm-spec
Checks, in A Standard Definition of Elm?:restriction core-binding-site-distinct
Not translated into Lean for the mechanisation of the book: see why.
A `let` block that defines `y` twice is rejected with a NAME CLASH error.
Results
elm-0.19.1
passOutput
Compiling ...-- NAME CLASH --------------------- src/NameClashTwoLetBindingsOfOneNameTest.elm
This `let` expression defines `y` more than once! One here:
17| y =
^
And another one here:
14| y =
^
How can I know which one you want? Rename one of them!
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- NAME CLASH --------------------- src/NameClashTwoLetBindingsOfOneNameTest.elm
This `let` expression defines `y` more than once! One here:
14| y =
^
And another one here:
17| y =
^
How can I know which one you want? Rename one of them!
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- NAME CLASH --------------------- src/NameClashTwoLetBindingsOfOneNameTest.elm
This `let` expression defines `y` more than once! One here:
14| y =
^
And another one here:
17| y =
^
How can I know which one you want? Rename one of them!
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- NAME CLASH --------------------- src/NameClashTwoLetBindingsOfOneNameTest.elm
This `let` expression defines `y` more than once! One here:
14| y =
^
And another one here:
17| y =
^
How can I know which one you want? Rename one of them!
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/NameClashTwoLetBindingsOfOneNameTest] in its title.
Source
The -- CHECK: lines give the expected output.
module NameClashTwoLetBindingsOfOneNameTest exposing (..)
{-| A `let` block that defines `y` twice is rejected with a NAME CLASH error.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, core-binding-site-distinct
-- COMPILE-ERROR: NAME CLASH, two let bindings of one name
-- CHECK: -- NAME CLASH -
testValue =
let
y =
1
y =
2
in
y
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_NameClashTwoLetBindingsOfOneNameTest, 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_modsyn): res:core-binding-site-distinct. It holds for every derivation, with no hypothesis about principality.