Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Unity Mono AOT iOS failure for generic method

$
0
0
Hi there. We're bumping into AOT limitations of Mono. Basically we have this: Attempting to JIT compile 'com.tinylabproductions.TLPLib.Functional.Option:fold, bool> (com.tinylabproductions.TLPLib.Functional.Option`1>,System.Fn`1,System.Fn`2, bool>)' while running with --aot-only. Which looks a bit horrible. :) Fold was defined as: interface Option { B fold(Fn ifEmpty, Fn ifSome); } Fn is a delegate type we have defined: public delegate R Fn(P1 p1); However upon reading [http://www.reentrygames.com/unity-3d-using-extension-methods-to-solve-problems-with-generics-and-aot-on-ios/][1] I've tried changing all generic interface calls to static extension methods like: public static class Option { public static B fold( this Option opt, Fn ifEmpty, Fn ifNonEmpty ) { return opt.isDefined ? ifNonEmpty(opt.get) : ifEmpty(); } } However AOT is still not picking it up. The call site looks like: public interface Promise { /** Complete with value, return false if already completed. **/ bool tryComplete(Try v); } class FutureImpl : Future, Promise { private Option> _value = F.none>(); public bool tryComplete(Try v) { // FOLD FAILS HERE. var ret = value. fold(() => { _value = F.some(v); return true; }, _ => false); completed(v); return ret; } } public interface Try { ... } I was wondering if you guys bumped into this and perhaps could share tips and tricks to work around this. Or have you ditched generics all together? Thanks a lot! [1]: http://www.reentrygames.com/unity-3d-using-extension-methods-to-solve-problems-with-generics-and-aot-on-ios/

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>