-
Notifications
You must be signed in to change notification settings - Fork 63
Open
ocaml/dune
#10644Description
test.ml:
open Tyxml.Html
let zz = p [ a [ txt "a" ] ]
dune-project:
(lang dune 2.5)
(implicit_transitive_deps false)
dune:
(executable
(name test)
(libraries tyxml))
This fails to build with hair-raising error :
$ dune build
File "test.ml", line 2, characters 13-26:
2 | let zz = p [ a [ txt "a" ] ]
^^^^^^^^^^^^^
Error: This expression has type
([> ([> Html_types.txt ] as 'b) Html_types.a ] as 'a) elt
but an expression was expected of type
([< Html_types.p_content_fun ] as 'c) elt
Type 'a = [> `A of 'b ] is not compatible with type
'c =
[< `A of Html_types.phrasing_without_interactive
| `Abbr
| `Audio of Html_types.phrasing_without_media
| `Audio_interactive of Html_types.phrasing_without_media
| `B
| `Bdo
| `Br
| `Button
| `Canvas of Html_types.phrasing
| `Cite
| `Code
| `Command
| `Datalist
| `Del of Html_types.phrasing
| `Dfn
| `Em
| `Embed
| `I
| `Iframe
| `Img
| `Img_interactive
| `Input
| `Ins of Html_types.phrasing
| `Kbd
| `Keygen
| `Label
| `Map of Html_types.phrasing
| `Mark
| `Meter
| `Noscript of Html_types.phrasing_without_noscript
| `Object of Html_types.phrasing
| `Object_interactive of Html_types.phrasing
| `Output
| `PCDATA
| `Progress
| `Q
| `Ruby
| `Samp
| `Script
| `Select
| `Small
| `Span
| `Strong
| `Sub
| `Sup
| `Svg
| `Template
| `Textarea
| `Time
| `U
| `Var
| `Video of Html_types.phrasing_without_media
| `Video_interactive of Html_types.phrasing_without_media
| `Wbr ]
Type 'b = [> `PCDATA ] is not compatible with type
Html_types.phrasing_without_interactive
Types for tag `A are incompatible
I believe the reason is that tyxml.functor is not in scope during build, so some types become abstract (I am still confused why the build proceeds instead of failing), and then it leads to such an error.
Solution: explicitly add tyxml.functor to libraries stanza in my project
I believe this can be fixed on tyxml side by using (re_export tyxml.functor)
(but requires upgrade to dune 2)
Metadata
Metadata
Assignees
Labels
No labels