Acknowledged

bug: drawable variable doesn't know it's type: Cannot determine type for creation

Both with SDK 7.4.3 and 8.0.0-Beta:
function draw1(dc as Dc) {
    var statusIconId = Rez.Drawables.pause;
    var statusIcon = new statusIconId(); // WARN: Cannot determine type for creation.
	statusIcon.draw(dc); // WARN: Cannot determine type for method invocation.
}

function draw2(dc as Dc, isPaused as Boolean) {
    var statusIconId = isPaused ? Rez.Drawables.pause : Rez.Drawables.stop;
    var statusIcon = new statusIconId(); // ERROR: Cannot instantiate object of type 'PolyType<$.Rez.Drawables.pause or $.Rez.Drawables.stop>'.
	statusIcon.draw(dc); // WARN: Cannot determine type for method invocation.
}

manifest.xml:
project.typecheck = 2
project.optimization = 3z
See also: https://forums.garmin.com/developer/connect-iq/i/bug-reports/bug-cannot-instantiate-object-of-type-polytype-rez-drawables-foo-or-rez-drawables-bar
  • for completeness, here's an example drawable:

        <drawable-list id="pause">
            <shape type="rectangle" x="0" y="0" width="101%" height="101%" border_width="6" border_color="Graphics.COLOR_YELLOW" color="Graphics.COLOR_TRANSPARENT" />
            <shape type="circle" x="center" y="center" radius="51%" border_width="8" border_color="Graphics.COLOR_YELLOW" color="Graphics.COLOR_TRANSPARENT" />
            <shape type="rectangle" x="35%" y="35%" width="12%" height="30%" color="Graphics.COLOR_YELLOW" />
            <shape type="rectangle" x="53%" y="35%" width="12%" height="30%" color="Graphics.COLOR_YELLOW" />
        </drawable-list>

  • This is still happening in SDK 8.1.0 with typecheck: 3