MissingPatternsAMissingTupleShapeTest
Tags:elm19-compile-errorelm-spec
Checks, in A Standard Definition of Elm?:restriction core-exhaustiveness
Not translated into Lean for the mechanisation of the book: see why.
A `case` on a pair of `Bool`s with no branch for `( False, False )` is rejected with a MISSING PATTERNS error. `either` matches `( True, _ )` and `( False, True )`; the remaining combination is left uncovered.
Results
elm-0.19.1
passOutput
Compiling ...-- MISSING PATTERNS -------------- src/MissingPatternsAMissingTupleShapeTest.elm
This `case` does not have branches for all possibilities:
16|> case pair of
17|> ( True, _ ) ->
18|> 1
19|>
20|> ( False, True ) ->
21|> 2
Missing possibilities include:
( False, False )
I would have to crash if I saw one of those. Add branches for them!
Hint: If you want to write the code for each branch later, use `Debug.todo` as a
placeholder. Read <https://elm-lang.org/0.19.1/missing-patterns> for more
guidance on this workflow.
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- MISSING PATTERNS -------------- src/MissingPatternsAMissingTupleShapeTest.elm
This `case` does not have branches for all possibilities:
16|> case pair of
17|> ( True, _ ) ->
18|> 1
19|>
20|> ( False, True ) ->
21|> 2
Missing possibilities include:
( False, False )
I would have to crash if I saw one of those. Add branches for them!
Hint: If you want to write the code for each branch later, use `Debug.todo` as a
placeholder. Read <https://elm-lang.org/0.19.2/missing-patterns> for more
guidance on this workflow.
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- MISSING PATTERNS -------------- src/MissingPatternsAMissingTupleShapeTest.elm
This `case` does not have branches for all possibilities:
16|> case pair of
17|> ( True, _ ) ->
18|> 1
19|>
20|> ( False, True ) ->
21|> 2
Missing possibilities include:
( False, False )
I would have to crash if I saw one of those. Add branches for them!
Hint: If you want to write the code for each branch later, use `Debug.todo` as a
placeholder. Read <https://elm-lang.org/0.19.3/missing-patterns> for more
guidance on this workflow.
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- MISSING PATTERNS -------------- src/MissingPatternsAMissingTupleShapeTest.elm
This `case` does not have branches for all possibilities:
16|> case pair of
17|> ( True, _ ) ->
18|> 1
19|>
20|> ( False, True ) ->
21|> 2
Missing possibilities include:
( False, False )
I would have to crash if I saw one of those. Add branches for them!
Hint: If you want to write the code for each branch later, use `Debug.todo` as a
placeholder. Read <https://elm-lang.org/0.19.3/missing-patterns> for more
guidance on this workflow.
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/MissingPatternsAMissingTupleShapeTest] in its title.
Source
The -- CHECK: lines give the expected output.
module MissingPatternsAMissingTupleShapeTest exposing (..)
{-| A `case` on a pair of `Bool`s with no branch for `( False, False )` is rejected with a MISSING PATTERNS error.
`either` matches `( True, _ )` and `( False, True )`; the remaining combination is
left uncovered.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, core-exhaustiveness
-- COMPILE-ERROR: MISSING PATTERNS, a missing tuple shape
-- CHECK: -- MISSING PATTERNS -
either pair =
case pair of
( True, _ ) ->
1
( False, True ) ->
2
testValue =
either ( True, False )
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_MissingPatternsAMissingTupleShapeTest, in StandardElmMech/Certs/). The program breaks a further restriction (Chapter 9) in every derivation (Stat.not_legal_of_furtherFailB). It holds for every derivation, with no hypothesis about principality.