Acknowledged

bug: compilation fails because of code inside removed has block

I get a compilation error:

ERROR: fenix5: AppView.mc:38,4: Could not find method onTimerEvent on object $.AppView

I don't think I am supposed to get. SDK: 7.4.3, device: fenix5 that doesn't support ActivityRecording.Session.setTimerEventListener , and this is my relevant part of the code:

(Sorry for the unformatted code, can't post code! see: https://forums.garmin.com/developer/connect-iq/f/discussion/389914/meta-forum-returning-lots-of-errors-today-e-g-parens-links-and-images-cause-problems )

and monkey.jungle:

project.optimization = 3z
fenix5.excludeAnnotations=$(fenix5.excludeAnnotations);session_timer_event_listener
When I remove the (:session_timer_event_listener) then it compiles, but why do I need to have an empty function just to be able to compile something that can be never called?
Note that the block for the has is correctly removed ("never called is not logged"). This is my command line for compilation:
java -Xms1g -Dfile.encoding=UTF-8 -Dapple.awt.UIElement=true -jar ~/Library/Application Support/Garmin/ConnectIQ/Sdks/connectiq-sdk-mac-7.4.3-2024-12-11-90ec25e45/bin/monkeybrains.jar -o bin/App.prg -f App/monkey.jungle -y garmin/garmin_developer_key.der -d fenix5_sim -w
Parents
  • > - if-blocks are being removed at compile time, but too late to avoid an error about being unable to find a symbol that's called within a removed if-block

    IOW, I can imagine the following actions taking place in separate passes (in the stated order):

    A) compiler removes code based on excludeAnnotations

    B) compiler checks for functions and variables that are referenced but not defined

    C) optimizer removes if-else-branches when the value of the if-condition is known at compile time

    Maybe all that needs to happen is C needs to be moved before B)

Comment
  • > - if-blocks are being removed at compile time, but too late to avoid an error about being unable to find a symbol that's called within a removed if-block

    IOW, I can imagine the following actions taking place in separate passes (in the stated order):

    A) compiler removes code based on excludeAnnotations

    B) compiler checks for functions and variables that are referenced but not defined

    C) optimizer removes if-else-branches when the value of the if-condition is known at compile time

    Maybe all that needs to happen is C needs to be moved before B)

Children
No Data