Misleading error message when loading an app with an empty function
James103 opened this issue · 2 comments
As of Carpet Mod 1.4.28 for Minecraft 1.16.5, if you try to load an app containing an empty function (i.e. with no statements in its body), you get the error message of Unnecessary semicolon
, which is misleading because interpreting it directly will only cause further errors a majority of the time.
I would expect either of the following:
- The app loads along with its empty functions.
- The app fails loading with a more specific error message, stating that a function can't be empty. The function will either need to have actual code in it to run (even a single English letter such as
s
works) or the function will need to be removed from the source code.
Mods used:
[✔️] attribute-fix-fabric-1.0.1
[✔️] carpet-extra-1.16.5-1.4.27
[✔️] clientcommands-2.4.9
[✔️] DisableCustomWorldsAdvice-1.2
[✔️] fabric-api-0.31.0+1.16
[✔️] fabric-carpet-1.16.5-1.4.28+v210224
[✔️] itemscroller-fabric-1.16.4-0.15.0-dev.20210111.205029
[✔️] litematica-fabric-1.16.4-0.0.0-dev.20210120.213004
[✔️] lithium-fabric-mc1.16.5-0.6.4
[✔️] malilib-fabric-1.16.4-0.10.0-dev.21+arne.2
[✔️] minihud-fabric-1.16.4-0.19.0-dev.20201103.184029
[✔️] modmenu-1.16.8
[✔️] NoFog-1.16.2b1-Fabric
[❌] notenoughcrashes-3.1.7-fabric.jar (disabled)
[✔️] phosphor-fabric-mc1.16.3-0.7.1+build.11
[✔️] shulkerboxtooltip-2.3.5+1.16.5
[✔️] tweakeroo-fabric-1.16.4-0.10.0-dev.20210209.145902
[✔️] Xaeros_Minimap_21.4.1_Fabric_1.16.5
[✔️] XaerosWorldMap_1.12.1_Fabric_1.16.5
The error message comes from validating of the parsed expression. The ->
operator requires both operands, function signature on the LHS and function body on the RHS. its like 2+2
, you need both sides.
There are ways to privide empty body. Function can do nothing:
fun(a, b, c) -> null;
you can also use 'tbd' operator to indicate that the method is work in progress and shoudn't be called
fun(a, b, c) -> ... wip;