Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Elm.elm
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,12 @@ portIncoming nameStr arg =
, typeAnnotation =
Compiler.nodify
(Annotation.FunctionTypeAnnotation
(Compiler.nodify (Compiler.getInnerAnnotation index arg))
(Compiler.nodify
(Annotation.FunctionTypeAnnotation
(Compiler.nodify (Compiler.getInnerAnnotation index arg))
(Compiler.nodify (Annotation.GenericType "msg"))
)
)
(Compiler.nodify sub)
)
}
Expand Down Expand Up @@ -2459,4 +2464,3 @@ typeConstructorIsExposed name (Node _ node) =

Expose.TypeExpose myType ->
name == myType.name

17 changes: 17 additions & 0 deletions tests/Declare.elm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ suite =
, customTypeTest
, customTypeWithTest
, newStyleTest
, ports
]


Expand Down Expand Up @@ -396,3 +397,19 @@ makeAndCaseGenerationFullyDynamic =
"""
]
()


ports : Test
ports =
describe "ports"
[ test "incoming" <|
\_ ->
Elm.portIncoming "receive" Type.int
|> Elm.Expect.declarationAs
"port receive : (Int -> msg) -> Sub msg"
, test "outgoing" <|
\_ ->
Elm.portOutgoing "send" Type.int
|> Elm.Expect.declarationAs
"port send : Int -> Cmd msg"
]