PortProblemDeclarationWithoutNameTest
Tags:elm19-compile-errorelm-spec
Checks, in A Standard Definition of Elm?:figure grammar-top-level-declarations
Not translated into Lean for the mechanisation of the book: see why.
A `port` keyword at the end of a module with no name or type after it is rejected with a PORT PROBLEM syntax error.
Results
elm-0.19.1
passOutput
Compiling ...-- PORT PROBLEM ------------------ src/PortProblemDeclarationWithoutNameTest.elm
I just saw the start of a `port` declaration, but then I got stuck here:
22| port
^
I was expecting to see a name like send or receive next. Something that starts
with a lower-case letter.
Note: Here are some example `port` declarations for reference:
port send : String -> Cmd msg
port receive : (String -> msg) -> Sub msg
The first line defines a `send` port so you can send strings out to JavaScript.
Maybe you send them on a WebSocket or put them into IndexedDB. The second line
defines a `receive` port so you can receive strings from JavaScript. Maybe you
get receive messages when new WebSocket messages come in or when the IndexedDB
is changed for some external reason.
Detected problems in 1 module.
elm-0.19.2
passOutput
Compiling ...-- PORT PROBLEM ------------------ src/PortProblemDeclarationWithoutNameTest.elm
I just saw the start of a `port` declaration, but then I got stuck here:
22| port
^
I was expecting to see a name like send or receive next. Something that starts
with a lower-case letter.
Note: Here are some example `port` declarations for reference:
port send : String -> Cmd msg
port receive : (String -> msg) -> Sub msg
The first line defines a `send` port so you can send strings out to JavaScript.
Maybe you send them on a WebSocket or put them into IndexedDB. The second line
defines a `receive` port so you can receive strings from JavaScript. Maybe you
get receive messages when new WebSocket messages come in or when the IndexedDB
is changed for some external reason.
Detected problems in 1 module.
elm-0.19.3
passOutput
Compiling ...-- PORT PROBLEM ------------------ src/PortProblemDeclarationWithoutNameTest.elm
I just saw the start of a `port` declaration, but then I got stuck here:
22| port
^
I was expecting to see a name like send or receive next. Something that starts
with a lower-case letter.
Note: Here are some example `port` declarations for reference:
port send : String -> Cmd msg
port receive : (String -> msg) -> Sub msg
The first line defines a `send` port so you can send strings out to JavaScript.
Maybe you send them on a WebSocket or put them into IndexedDB. The second line
defines a `receive` port so you can receive strings from JavaScript. Maybe you
get receive messages when new WebSocket messages come in or when the IndexedDB
is changed for some external reason.
Detected problems in 1 module.
lamdera-1.5.0
passOutput
Detected problems in 1 module.
-- PORT PROBLEM ------------------ src/PortProblemDeclarationWithoutNameTest.elm
I just saw the start of a `port` declaration, but then I got stuck here:
22| port
^
I was expecting to see a name like send or receive next. Something that starts
with a lower-case letter.
Note: Here are some example `port` declarations for reference:
port send : String -> Cmd msg
port receive : (String -> msg) -> Sub msg
The first line defines a `send` port so you can send strings out to JavaScript.
Maybe you send them on a WebSocket or put them into IndexedDB. The second line
defines a `receive` port so you can receive strings from JavaScript. Maybe you
get receive messages when new WebSocket messages come in or when the IndexedDB
is changed for some external reason.
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm/PortProblemDeclarationWithoutNameTest] in its title.
Source
The -- CHECK: lines give the expected output.
port module PortProblemDeclarationWithoutNameTest exposing (..)
{-| A `port` keyword at the end of a module with no name or type after it is rejected with a PORT PROBLEM syntax error.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, fig:grammar-top-level-declarations
-- COMPILE-ERROR: PORT PROBLEM
-- CHECK: -- PORT PROBLEM -
import Array
import Bytes
import Json.Decode
import Json.Encode
type alias Point =
{ x : Int }
port 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.