Under Review
over 2 years ago

SDK 4.2.0 Beta 1 won't compile AppBase.getProperty

Given

  return Application.getApp().getProperty(s);
The compiler reports
  ERROR: fr235: test.mc: '$.Toybox.Application.AppBase.getProperty' is deprecated.
But fr235 doesn't support Application.Properties.getValue, so I *have* to use getProperty when compiling for fr235.
  • Now I know its type checker related, I can work around this by putting (:typecheck(false)) on the affected method. The method already uses exclude annotations so its only used for devices that actually need it, so thats not too bad.

    But conflating deprecation error level with type check level still seems like a big mistake.

  • I always compile with Strict. I didn't think to try without, because this really doesn't look like a type checker error. Checking for deprecated functions should really be a separate option. Also, functions should only be deprecated when there's an alternative - ie its fine to deprecate AppBase.getProperty for newer devices; but deprecating it for devices that have to use it makes no sense at all...

  • What is your type check level set to in the VS Code Monkey C Extension settings? I see the same problem if the level is set to Informative or Strict, but do not see the error at the Gradual level or when type checking is off.