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