Acknowledged
CIQQA-3894

bug: documentation of AppBase.onDeviceSettingChanged has code that gives warning

In https://developer.garmin.com/connect-iq/api-docs/Toybox/Application/AppBase.html#onDeviceSettingChanged-instance_function we have this example:

using Toybox.System;

function onDeviceSettingChanged(aSymbol as Symbol, aValue as Object) as Void {
    if (aSymbol == :distanceUnits) {
        var newUnitSystem = aValue as UnitSystem;
        System.println("Distance Units => " + (newUnitSystem == System.UNIT_METRIC ? "Metric" : "Statute"));
    }
}

With strict typecheck this gives the following warning:

The private symbol 'distanceUnits' will not be found when using the indirect lookup syntax ':distanceUnits'. Consider making 'distanceUnits' public / protected or use a direct reference 'self.distanceUnits'.

Which makes me worried, as I am not sure if this is just a stupid warning, that shouldn't be there, or if it has any base, in which case how am I supposed to fix my code to be sure it always works?

Parents
  • ... though I use :temperatureUnits rather than distance, I don't get an error with typecheck strict and, same (no errors, no warnings) when I changed code to :distanceUnits to see if I could replicate.

    So it's not a generic case.  The project I have is a Simple DataField, only targetting Edge devices on SDK 8.4.1.  Odd!

Comment
  • ... though I use :temperatureUnits rather than distance, I don't get an error with typecheck strict and, same (no errors, no warnings) when I changed code to :distanceUnits to see if I could replicate.

    So it's not a generic case.  The project I have is a Simple DataField, only targetting Edge devices on SDK 8.4.1.  Odd!

Children
No Data