AnnotationNotFollowedByDefinitionTest
Tags:elm-spec
Checks, in A Standard Definition of Elm?:restriction core-annotation-placement
Not translated into Lean for the mechanisation of the book: see why.
An annotation must be followed directly by the definition it annotates. A Standard Definition of Elm?, restriction core-annotation-placement: in source text each annotation `x : t` is followed directly by a definition of the same `x`. Here the annotation of `f` is followed by the definition of `g`. <https://elm-test-suite.netlify.app/standard/restrictions/core-annotation-placement>
Results
elm-0.19.1
passOutput
Compiling ...-- NAME MISMATCH ----------------- src/AnnotationNotFollowedByDefinitionTest.elm
I just saw a type annotation for `f`, but it is followed by a definition for
`g`:
18| f : Int
19| g =
^
These names do not match! Is there a typo?
g -> f
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- NAME MISMATCH ----------------- src/AnnotationNotFollowedByDefinitionTest.elm
I just saw a type annotation for `f`, but it is followed by a definition for
`g`:
18| f : Int
19| g =
^
These names do not match! Is there a typo?
g -> f
Detected problems in 1 module.
elm-0.19.3
passOutput
Dependencies ready!
Compiling ...-- NAME MISMATCH ----------------- src/AnnotationNotFollowedByDefinitionTest.elm
I just saw a type annotation for `f`, but it is followed by a definition for
`g`:
18| f : Int
19| g =
^
These names do not match! Is there a typo?
g -> f
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- NAME MISMATCH ----------------- src/AnnotationNotFollowedByDefinitionTest.elm
I just saw a type annotation for `f`, but it is followed by a definition for
`g`:
18| f : Int
19| g =
^
These names do not match! Is there a typo?
g -> f
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/AnnotationNotFollowedByDefinitionTest] in its title.
Source
The -- CHECK: lines give the expected output.
module AnnotationNotFollowedByDefinitionTest exposing (main)
{-| An annotation must be followed directly by the definition it annotates.
A Standard Definition of Elm?, restriction core-annotation-placement: in source text each
annotation `x : t` is followed directly by a definition of the same `x`. Here the annotation of
`f` is followed by the definition of `g`. <https://elm-test-suite.netlify.app/standard/restrictions/core-annotation-placement>
-}
-- TAGS: elm-spec, core-annotation-placement
-- COMPILE-ERROR: an annotation separated from its definition
-- CHECK: {{-- [A-Z ]+ -}}
import Html
f : Int
g =
2
f =
1
main =
Html.text (Debug.toString (f + g))
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 eco's parser rejects it too. See the Lean mechanisation for which tests are in Lean, and why.