I've fixed a few new errors the BETA compiler found in my code. But I'm getting HUNDREDS of these warnings. I have no clue what it is expecting me to do here. Any ideas?
I've fixed a few new errors the BETA compiler found in my code. But I'm getting HUNDREDS of these warnings. I have no clue what it is expecting me to do here. Any ideas?
See https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/optimal-monkey-c
It talks about -L and -O
Type Checking has been there for some time, but the default was that it was off. With…
None of your arrays are typed, it might be the issue. I would add types:
var SysColors as Array<Graphics.ColorType> = [...] as Array<Graphics.ColorType>;
etc...
For existing apps, I would simply turn off type checking (-l0) as it's going to be more than a simple change to use type checking, especially if you have a bunch of apps.
If you have a mature and established…
you have to add
-l 0
option to switch off type checking
Ah Thanks! I can't find a compiler option reference. I've seen people talk about -I and -L and now -O.
See https://forums.garmin.com/developer/connect-iq/b/news-announcements/posts/optimal-monkey-c
It talks about -L and -O
Type Checking has been there for some time, but the default was that it was off. With the Beta SDK, it's now on.
It has some problem with a container, so probably with the PWR / SysColors / box / Fonts arrays. Can you post their declaration so we can see their type?
Thanks. See anything here? SysColors and Fonts are global. box is at the module level. Maybe the PWR array because it uses multiple types? This works without warning in until the beta compiler.
None of your arrays are typed, it might be the issue. I would add types:
var SysColors as Array<Graphics.ColorType> = [...] as Array<Graphics.ColorType>;
etc...
For existing apps, I would simply turn off type checking (-l0) as it's going to be more than a simple change to use type checking, especially if you have a bunch of apps.
If you have a mature and established app, I don't think adding type checking does much for you except cluttering up the code.
Note that compiler options are case-sensitive, and the option for changing the type-checking level is -l (lowercase L), not -L.
You can see a full list of compiler options by passing in the -h option.
Also, you can set the type-check level using an option in the VS Code Monkey C user/workspace settings (no need to set the command line option manually):
I'm getting "Cannot resolve type 'Byte'" (as well as bool, String, Number) errors with my code which compiles and runs smoothly with 4.1.4 no Beta. Is this a bug or a new feature?
Those errors are thrown for function definitions, like e.g. this ones:
public function encode(b as Byte) as bool {
I don't think Byte and bool are actual Monkey C types. Try Number and Boolean instead.
For the other errors (String, Number), make sure you have the following line at the top of your source files:
import Toybox.Lang;