mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-08 18:46:12 +00:00
Fixed Avoid Error Implicit coercion of a value of type XXX to an unrelated type YYY
This commit is contained in:
@@ -1031,6 +1031,23 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImplicitCoerce() {
|
||||
decompileMethod("classic_air", "testImplicitCoerce", "var j:int = 2;\r\n"
|
||||
+ "var i:int = 5;\r\n"
|
||||
+ "var r:* = Math.random();\r\n"
|
||||
+ "if(j & Number(r == 1) && 5)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"OK\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "var s:String = \"hello: \" + r;\r\n"
|
||||
+ "if(s)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"F\");\r\n"
|
||||
+ "}\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportedVar() {
|
||||
decompileMethod("classic_air", "testImportedVar", "trace(myvar);\r\n"
|
||||
|
||||
@@ -1026,6 +1026,23 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImplicitCoerce() {
|
||||
decompileMethod("classic", "testImplicitCoerce", "var j:int = 2;\r\n"
|
||||
+ "var i:int = 5;\r\n"
|
||||
+ "var r:* = Math.random();\r\n"
|
||||
+ "if(Boolean(j & Number(r == 1)) && Boolean(5))\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"OK\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "var s:String = \"hello: \" + r;\r\n"
|
||||
+ "if(Boolean(s))\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"F\");\r\n"
|
||||
+ "}\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testImportedVar() {
|
||||
decompileMethod("classic", "testImportedVar", "trace(myvar);\r\n"
|
||||
|
||||
Reference in New Issue
Block a user