waneck / testrepo

0 stars 0 forks source link

Issue 1831 - @:coreType abstract can't add @:op() functions - haxe #1831

Open waneck opened 11 years ago

waneck commented 11 years ago

[Google Issue #1831 : http://code.google.com/haxe/issues/detail?id=1831] by waneck, at 2013-05-20T10:40:23.000Z @:notNull @:runtimeValue @:coreType abstract NativeInt64 from Int { @:op(A+B) public static function add(a:NativeInt64, b:NativeInt64):NativeInt64; }

will fail with "Abstract is missing underlying type declaration"

Also for coreTypes it would be great if the @:op functions could be private, as they don't really exist (so e.g. calling NativeInt64.add() would be an error/misleading)

Thanks!

waneck commented 11 years ago

[comment from si...@haxe.org, published at 2013-05-20T10:41:18.000Z] I think we should treat @:coreType functions as their underlying type when dealing with operators.

waneck commented 11 years ago

[comment from waneck, published at 2013-05-20T10:43:13.000Z] what do you mean with underlying type? the first from/to that is declared? I agree that this approach would be much more straight-forward!

waneck commented 11 years ago

[comment from waneck, published at 2013-05-20T10:44:17.000Z] Although e.g. in the case above, NativeInt64 + NativeInt64 shouldn't be typed as Int, and also NativeInt64 / NativeInt64 should still be a NativeInt64

waneck commented 11 years ago

[comment from si...@haxe.org, published at 2013-05-20T10:44:22.000Z] Actually I have no idea what I meant by that.

waneck commented 11 years ago

[comment from waneck, published at 2013-05-20T10:47:18.000Z]

waneck commented 11 years ago

[comment from ncanna...@gmail.com, published at 2013-05-20T12:34:24.000Z] ATM we don't have a way to define custom operations on coreType abstracts. I suggest we wait for post 3.0 for that.