I've encountered some strange things in the compiler lately. It turns out it's not SDK version related (at least it happens also in SDK 8.4.0, 8.3.0, 8.2.3, 8.1.1). I think it is somehow related to project size and optimization (maybe just how the compiler works).
What happens is that I do a tiny little change somewhere in my code, and then a totally nonsense error pops up in a different place. I have now an example (though it's just to demonstrate the issue, I don't think anyone will be able to reproduce this without my project) where this happens within a file. This is the file:
import Toybox.Graphics; import Toybox.Lang; /* * 205 x 148 SQUARE FONT GROUP A * DEVICES: * - vivoactive */ const LAYOUT_LINE1 = 15; const LAYOUT_LINE2 = 42; const LAYOUT_LINE3 = 95; const LAYOUT_LINE4 = 120; const LAYOUT_stepGoalProgressOffsetX = 0; const LAYOUT_stepGoalProgressHeight = 3; const LAYOUT_centerOffsetX = 4; const LAYOUT_clockY = 5; const LAYOUT_clockOffsetX = 0; const LAYOUT_topRowY = LAYOUT_LINE1 + 12; const LAYOUT_middleRowOffsetX = 5; const LAYOUT_middleRowLabelY = LAYOUT_LINE2 + 8; const LAYOUT_middleRowValueY = LAYOUT_LINE2 + 8 + 25; // line with small change const LAYOUT_heartRateIconY = LAYOUT_LINE3 - 20; const LAYOUT_heartRateIconHRZY = 107; const LAYOUT_heartRateIconWidth = 20; const LAYOUT_heartRateIconHRZWidth = 28; const LAYOUT_heartRateIconXOffset = 2; const LAYOUT_heartRateIconHRZXOffset = 2; const LAYOUT_heartRateTextY = LAYOUT_middleRowLabelY; const LAYOUT_bottomRowUpperTextY = 160; const LAYOUT_bottomRowLowerTextY = 185; const LAYOUT_bottomRowIconX = 4; const LAYOUT_bottomRowIconY = 155; const LAYOUT_batteryY = 222; const LAYOUT_batteryX = 0; const LAYOUT_batteryWidth = 49; const LAYOUT_batteryHeight = 22; const LAYOUT_timeFont = Graphics.FONT_XTINY; const LAYOUT_topRowFont = Graphics.FONT_MEDIUM; const LAYOUT_heartRateFont = Graphics.FONT_MEDIUM; const LAYOUT_middleRowLabelFont = Graphics.FONT_XTINY; const LAYOUT_middleRowValueFontShrunk = Graphics.FONT_LARGE; const LAYOUT_middleRowValueFont = Graphics.FONT_NUMBER_MEDIUM; const LAYOUT_bottomRowFont = Graphics.FONT_MEDIUM; // line with error const LAYOUT_batteryFont = Graphics.FONT_XTINY; const LAYOUT_eightColourPalette = false; const LAYOUT_GPS_ICON_X = 58; const LAYOUT_GPS_ICON_Y = 211; const LAYOUT_WIDTH = 205;
If the line is:
const LAYOUT_heartRateIconY = LAYOUT_LINE3;
const LAYOUT_heartRateIconY = LAYOUT_LINE3 - 20;