Both with SDK 7.4.3 and 8.0.0-Beta:
the compiler can't instantiate an object of polytype where each option is a drawable:
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
Interestingly this works (except I can't post the code...):
function draw3(dc as Dc, a as Boolean, b as Boolean, c as Boolean) as Void { var x; if (a) { if (b) { x = Rez.Drawables.play; } else { x = c ? Rez.Drawables.pause : Rez.Drawables.stop; } } else { x = null; }
if (x != null) {
var y = new x(); // WARN: Cannot determine type for creation y.draw(dc); // WARN: Cannot determine type for method invocation
}
}
Oh, for F*CK sake! Please fix the forum!!!!! Why can't we post legit MC code????
Why am I wasting my time on editing and trying to post the code line by line for 30 minutes????