InfixNonAssocEqTwiceTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction core-operator-chainfigure core-fixities
Not translated into Lean for the mechanisation of the book: see why.
`a == b == c` is not a phrase: `==` associates neither way. A Standard Definition of Elm?, restriction core-operator-chain: two operators of equal precedence with no operator of lower precedence between them must both associate to the left or both to the right; otherwise the chain is not a phrase of the language. <https://elm-test-suite.netlify.app/standard/restrictions/core-operator-chain> `True == False == False` would type grouped either way; it is rejected because of the chain.
Results
elm-0.19.1
passOutput
Compiling ...-- INFIX PROBLEM ------------------------------ src/InfixNonAssocEqTwiceTest.elm
You cannot mix (==) and (==) without parentheses.
22| Html.text (Debug.toString (True == False == False))
^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- INFIX PROBLEM ------------------------------ src/InfixNonAssocEqTwiceTest.elm
You cannot mix (==) and (==) without parentheses.
22| Html.text (Debug.toString (True == False == False))
^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- INFIX PROBLEM ------------------------------ src/InfixNonAssocEqTwiceTest.elm
You cannot mix (==) and (==) without parentheses.
22| Html.text (Debug.toString (True == False == False))
^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- INFIX PROBLEM ------------------------------ src/InfixNonAssocEqTwiceTest.elm
You cannot mix (==) and (==) without parentheses.
22| Html.text (Debug.toString (True == False == False))
^^^^^^^^^^^^^^^^^^^^^^
I do not know how to group these expressions. Add parentheses for me!
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/InfixNonAssocEqTwiceTest] in its title.
Source
The -- CHECK: lines give the expected output.
module InfixNonAssocEqTwiceTest exposing (main)
{-| `a == b == c` is not a phrase: `==` associates neither way.
A Standard Definition of Elm?, restriction core-operator-chain: two operators of equal
precedence with no operator of lower precedence between them must both associate to the left
or both to the right; otherwise the chain is not a phrase of the language. <https://elm-test-suite.netlify.app/standard/restrictions/core-operator-chain>
`True == False == False` would type grouped either way; it is rejected because of the chain.
-}
-- TAGS: elm-spec, core-operator-chain, fig:core-fixities
-- COMPILE-ERROR: a non-associative operator twice in a chain
-- CHECK: {{-- [A-Z ]+ -}}
-- CHECK-NOT: TYPE MISMATCH
import Html
main =
Html.text (Debug.toString (True == False == False))
Lean translation
No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Static semantics: expected to be rejected, and the translator's front end refuses it: it breaks a restriction on characters, tokens and layout, which Lean does not model. See the Lean mechanisation for which tests are in Lean, and why.