From 1501f5f55662ff02dc21861d6ab7c94b8b9215ab Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Tue, 17 Dec 2024 23:49:40 +0000 Subject: [PATCH] add comment about what code is triggering a compiler error --- fcore/player.sml | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/fcore/player.sml b/fcore/player.sml index c066c1a..7aa97b2 100644 --- a/fcore/player.sml +++ b/fcore/player.sml @@ -74,28 +74,30 @@ struct helpCheckPlatforms (yAxis, xAxis, x, y, health, jumpPressed, tl, wallList, game) | _ => - let - val {platforms, ...} = game - val {y = platY, ...} = Vector.sub (platforms, platID - 1) + let + (*** + *** cause of compiler error is here + *** The specific error is an error with optimising record representations. + *** + *** TO make the problem go away (at the cost of incorrectness), + *** one can: + *** 1. Delete the call to Vector.sub below + *** 2. Change the `platY` value below (in `platY - size`) + *** to any constant integer (like 300 or 555). + ***) - val newY = platY - size - in - helpCheckPlatforms - (ON_GROUND, xAxis, x, newY, health, jumpPressed, tl, wallList, game) - end) + val {platforms, ...} = game + val {y = platY, ...} = Vector.sub (platforms, platID - 1) + + val newY = platY - size + in + helpCheckPlatforms + (ON_GROUND, xAxis, x, newY, health, jumpPressed, tl, wallList, game) + end) | [] => checkWalls (yAxis, xAxis, x, y, health, jumpPressed, wallList, game) end - (*** MLTON STRANGE TYPES ERROR: - *** Trigger by deleting the longer `checkPlatforms` function - *** and uncommenting the function of the same name that raises Match. - - fun checkPlatforms (yAxis, xAxis, x, y, health, jumpPressed, game) = - raise Match - - *** *) - fun checkPlatforms (yAxis, xAxis, x, y, health, jumpPressed, game) = let val {wallTree, platformTree, ...} = game