Under Review
over 1 year ago

bug: compiler thinks all functions are background if one function in the class is annotated as such

SDK 4.1.7

import Toybox.Application;

(:background) const VER = "0.1";

(:foreground)
function set(key as PropertyKeyType, val as PropertyValueType) as Void {
    Application.Properties.setValue(key, val);
}

class Foo {
    (:foreground)
    public function onStart() as Void {
        set("v", VER);
    }
}

class Bar {
    (:background, :api3, :inline)
    function other() as Void {
        log("other backgrounnd");
    }

    (:foreground)
    public function onStart() as Void {
        set("v", VER);
    }
}

ERROR: fr255: Test.mc:25,8: Value 'set' not available in all function scopes.

As you can see Foo compiles, but Bar doesn't, because there's other() that is annotated as background.

Parents Comment Children
No Data