clemos / haxe-sublime-bundle

Sublime Text bundle for Haxe programming language
Apache License 2.0
237 stars 85 forks source link

Strange bug with sublime & erazor #62

Closed postite closed 11 years ago

postite commented 11 years ago

i didn't know where to post it (erazor or sublimetext) but i think it is more ST2 related (and you are related to both projects)

it's a bit hard to explain but it's about this error showing after specific target compilation (CTRL-enter)

here is my test code :

class Erazor 
{

    static public function main()
    {
        var temp:String=new JView().execute({test:"popo"});
        trace("temp="+temp);
    }
}

@:template("<div class='frame' >@test</div>")
class JView extends erazor.macro.Template<{test:String}>{}

and

class Neko 
{

    static public function main()
    {
        var temp:String=new NView().execute({test:"popo"});
        neko.Lib.print(temp);
    }
}

@:template("<div class='frame' >@test</div>")
class NView extends erazor.macro.Template<{test:String}>{}

wich i compile with :

-main Erazor
-lib erazorGit
-js raz.js

--next

-main Neko
-lib erazorGit
-neko index.n

-cmd open index.html
-cmd neko index.n

everything goes fine when building all target cases ( CTRL+B) but when i'm switching targets ( CTRL+SHIFT+B) and then compile (CTRL+ENTER) i get this error "Field execute should be declared with 'override' since it is inherited from superclass"

i use caue waneck's git source for macro erazor . do you know what's going on ? thx

clemos commented 11 years ago

Hi, I think I remember having this kind of issue, but unfortunately I can't seem to remember how I got rid of it... It seems the Template.execute method, which is only here for autocompletion, remains here even when actually building (without --display). So it may have to do with server-mode compilation, which I made default for ST2 recently. I suspect the compilation cache has problems with such conditionnal compilation. I believe my erazor version doesn't have anything different regarding this issue, but I almost always use a wrapper around Template classes, so I guess the compiler never goes down to the "execute" method for autocompletion, and thus the method doesn't get cached, and the problem doesn't occur.

You can try to workaround that by building without server-mode (see readme). Then if the issue is confirmed to be related to this, it would probably be an issue with Haxe itself (with conditional compilation + server-mode), which might be worked around by erazor (but I'm not sure)...