back2dos / tinkerbell

MIT License
83 stars 8 forks source link

@:forward through 2 levels fails #22

Closed raould closed 9 years ago

raould commented 12 years ago

pseudo code extracted from larger project:

class LevelSpec implements Cls { @:read var x = ; } class RunningLevel implements Cls { @:forward var spec:LevelSpec = ; } class Drawer { function foo(r:RunningLevel) { trace( r.x ); }

gives "RunningLevel has no field x"

this is like issue 19 but a different error message, at least.

back2dos commented 12 years ago

The following works for me: https://gist.github.com/3149957

Until recently, I sometimes ran into trouble with forward because of the order in which the compiler builds classes in the same module, e.g. it builds A before B although A forwards to B and thus the proper forward routines aren't generated.

The problem usually disappears if you reorder the classes or put them into separate modules.

Can you please confirm this works now or provide a minimal example?

raould commented 12 years ago

if i run into it again i can reopen and hopefully have example code.

when you say "until recently" do you mean that 2.10 fixed it or that tink itself changed to fix it?

back2dos commented 12 years ago

Well, if it really is fixed, then it's due to 2.10 changing its strategy in which order types are built. There's not much I could do about this in tink, that would actually perform decently.

So I'd rather have you confirm, that the problem is solved.

raould commented 12 years ago

i have not tried you sample yet, but my code still triggers the problem even with: haxe 2.10 (final, not rc, as far as i know) tink_collections: [0.2.0] tink_core: [1.0.3] tink_lang: 0.2.2 [0.2.4] tink_macros: [1.0.1] 1.0.2 tink_native: [0.1.0]

i have been trying to use "-D dump" to see if there would be any clues there, but it is another thing that works in the small but i cannot get to work on this project in the large.

back2dos commented 12 years ago

Well, it's really hard to tell what the problem is. The code you gave me above compiles (the gist I posted is not much more than that).

You will have to copy the project and then start throwing things out until you're left with a small example.