haxetink / tink_core

Core utilities
https://haxetink.github.io/tink_core
MIT License
117 stars 33 forks source link

dox - Incompatibilities between tink.core.Future in flash and js (could not merge definition) #82

Closed aliokan closed 5 years ago

aliokan commented 6 years ago
haxelib newrepo
haxelib install tink_core
haxelib install dox
haxe -lib tink_core --macro "include('tink')" -D doc-gen --no-output -xml xml/php.xml -php bin
haxe -lib tink_core --macro "include('tink')" -D doc-gen --no-output -xml xml/neko.xml -neko bin/docs.n
haxe -lib tink_core --macro "include('tink')" -D doc-gen --no-output -xml xml/js.xml -js bin/docs.js
haxe -lib tink_core --macro "include('tink')" -D doc-gen --no-output -xml xml/flash.xml -swf-version 11 -swf bin/docs.swf
haxelib run dox -i xml -o api --toplevel-package "tink"
Parsing xml/flash.xml
Parsing xml/js.xml
Called from ? line 1
Called from dox/Dox.hx line 146
Called from dox/Dox.hx line 139
Called from C:\GitHub\haxe\std/haxe/rtti/XmlParser.hx line 90
Called from C:\GitHub\haxe\std/haxe/rtti/XmlParser.hx line 317
Called from C:\GitHub\haxe\std/haxe/rtti/XmlParser.hx line 284
Uncaught exception - Incompatibilities between tink.core.Future in flash and js (could not merge definition)

tink.core.Future definition brokes hexMachina API generation: https://travis-ci.org/DoclerLabs/hexMachina/jobs/373031409

Any idea how to fix that?

back2dos commented 6 years ago

Hmm, seems that haxe.rtti chokes on this js-specific <icast />:

<abstract path="tink.core.Future" params="T" file="...">
  ...
  <from>
      ...
     <icast field="ofJsPromise"><c path="js.Promise"><c path="ofJsPromise.A"/></c></icast>
      ...
  </from>
  ...
</abstract>

The same goes for Promise btw.

The fun part is that dox doesn't even process the implicit casts, see Any. I'm inclined to say that how haxe.rtti determines "mergeability" of abstracts based on implicit casts is flawed. Let's ask @Simn, @Gama11 and @markknol what their take is on that ;)

markknol commented 6 years ago

If the xml is wrong then its a Haxe issue, otherwise it's one for dox.

Can you see if Any in the xml contains this implicit data?

back2dos commented 6 years ago

There is no problem with the treatment of Any. My point was rather that implicit casts were apparently never added to the dox templates, which is ironic because they are what the rtti parser is choking on. The question here is: should the js version and the flash version of tink.core.Future be considered incompatible because of an implicit cast or not. If so I'll probably have to pull some #if xml trickery or what not.

thomasjwebb commented 5 years ago

Is there a workaround for this? I tried adding -ex "^tink\." to dox but still get the "Incompatibilities.." error

back2dos commented 5 years ago

I'm inclined to say that this is a Haxe issue: https://github.com/HaxeFoundation/haxe/issues/7829