haxe C# error about @overload

41 views
Skip to first unread message

S.A. Asselbergs

unread,
Jun 14, 2016, 9:22:54 AM6/14/16
to Haxe
Hello fellow haxers,

I try to subclass a c# class (wich resides in some dll). Then I get this error message:

Field get_Author should be declared with @:overload since it was already declared as @:overload in superclass

Can anyone explain to me what I do wrong?



I expect this library (third party) to change often, which is why I like to to make externs, as I appearantly dont have to do because haxe does this automagically. However to me it is still a blackbox.

I use some library "SpaarModLoader.dll" which I add as a reference with conditional compiling of Haxe.

This is my haxe code

class ScriptingMod extends Mod
{   
    private static function main(){}
   
    @:overload(function():String{})
    public function get_Author(){
        return "";
    }
}


This is the native C# superclass within "SpaarModLoader.dll

using spaar.ModLoader.Internal;
using System;

namespace spaar.ModLoader {
    public abstract class Mod {
 
        public abstract string Author {
            get;
        }
 
    // other code ....
    }
}


 My conditional compiler settings in HaxeDevelop are
 
-dce no
-D -net-std=E:/source code/Haxe
-net-lib E:/source code/Haxe/Assembly-CSharp.dll
-net-lib E:/source code/Haxe/Assembly-CSharp-firstpass.dll
-net-lib E:/source code/Haxe/Assembly-UnityScript.dll
-net-lib E:/source code/Haxe/Assembly-UnityScript-firstpass.dll
-net-lib E:/source code/Haxe/UnityEngine.dll
-net-lib E:/source code/Haxe/SpaarModLoader.dll
-D dll

Cauê Waneck

unread,
Jun 14, 2016, 10:03:57 AM6/14/16
to haxe...@googlegroups.com
C# and Java use a different `@:overload` syntax, which don't need a function inside. The correct syntax would look like:
    @:overload override public function get_Author(){
        return "";
    }

Can you try this?

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Simon Asselbergs

unread,
Jun 14, 2016, 10:37:00 AM6/14/16
to haxe...@googlegroups.com

Hey Cauê,

Thanks a bunch for your, attention, time and answer!

I understand now why i didnt understood it :-)

Simon


Op 14-6-2016 om 16:03 schreef Cauê Waneck:
Reply all
Reply to author
Forward
0 new messages