-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[server] Type name X redefined from module X #8368
Comments
You can replace it with |
Indeed that works (i.e. causes the issue) too. |
A variant of the exact same issue: build.hxml # Just need any --macro call
--macro define('whatever')
-main Main
-D no-compilation Main.hx class Main {
public static function main():Void {
MyMacro.foo();
}
} MyMacro.hx class MyMacro {
#if macro
static var issue = haxe.macro.ComplexTypeTools.toType(macro :Type1);
// ^ this causes the issue
#end
public static macro function foo() return macro { };
} Type1.hx class Type1 {
public function new() {
trace(Type2);
}
} Type2.hx class Type2 {
public function new() {
trace(Type1);
}
} |
#8371 seems to have fixed this issue in my project. |
Some logs from my investigation (based on this sample): Issue is reproducible if In (1) the module "Type1" is loaded with While in (2) the module "Type1" is always loaded without So, I assume that for init expressions of static fields in macros the context is not properly set up. Also, In the sample "Type1" is always loaded with |
The same problem apears if i use |
Yeah in my project too it's the combo |
I'm reverting the fix, because it makes us to add more and more hacks. We will look for a better solution. |
Here's my preliminary conclusion on what goes wrong in general: Compilation 1signature A
signature B
Compilation 2signature A
signature B
|
Is this fixed in Haxe 4.0.0? |
No |
This comment has been minimized.
This comment has been minimized.
I still don't know how to fix this properly. |
It seems to be possible to trigger this bug or one thats related. The error message is abit different: Steps to reproduce:
Offtopic: it would be nice to also have "interpolation" for interfaces in class reification like this |
But you're not guarding against redefining, in case of compilation server (which is used for completion but can be used for compilation too) this code can run several times. |
Since I'm not in control of the compliation server. Is that a valid scenario you would need to guard against and is it possible in a feasible way? I added a static boolean outside the build function in a attempt to make the build macro only run once, this doesnt work. In this example there should only be one interface that extend the @:autoBuild one. |
If you want static bools to persist between compilations, you will need to annotate them with |
After adding |
In my case, this was being caused by the use of -macro include() in the .hxml. Removing those calls fixed the issue. This error was being quietly spit by the completion server and wasn't showing up in compilation. While the completion server was outputting this error, it shut down all completion in the IDE, effectively making the entire project unworkable. I know that the vscode extension has its own repo to post in, but while I'm here: I think some priority should be given to stabilizing the IDE, as in my experience it randomly stops functioning for weird, untraceable reasons, which causes big timesinks. Errors in the project will cause the intellisense to stop working, but that's when you would need intellisense the most. |
@shealyrd What Haxe version is that in your case? |
4.2.5, I'll try updating to 4.3 and see if it helps |
Yeah this exact issue should be solved with 4.3.0. There are other ways to have the issue, though. |
I think the original issue has been addressed, but the history here is a mess so I can't really tell. I'll close regardless because I don't want everyone who runs into this particular error to come here. |
There's been a lot of talk about this type of error. I'm not sure if it's one issue or multiple, but I managed to make a minimal example for my current one. Interestingly it's very similar to #8043 (comment) from my previous issue.
hxml
Main.hx
MyMacro.hx
Compiling this normally works. First compile via
haxe --connect 6000 build.hxml
works, second one will result inC:\HaxeToolkit\std/js/lib/Uint8Array.hx:28: characters 36-51 : Type name js.lib.Uint8Array is redefined from module js.lib.Uint8Array
.It's the combination of the
ComplexTypeTools.toType
and the hxnodejs library (tested with haxelib latest, 6.9.1).Haxe version 877addc.
Possibly related to #6993, #4234, #5725. Maybe also related to #7279, I'm not sure as that seems to complain more about the error reporting than the error being false.
The text was updated successfully, but these errors were encountered: