Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12781] iOS: Wrong result of typeof

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsexalture, reprod
ReporterHans Joachim
AssigneeUnknown
Created2013-02-05T22:54:23.000+0000
Updated2018-02-28T20:04:22.000+0000

Description

Issue

An undefined key, which is starting with the character sequence "get", of an object of type TiUIWindow results in an undesired behaviour of typeof:
 
 var foo1 = {}; 
 Ti.API.debug( typeof foo1.hallo); 
 Ti.API.debug( typeof foo1.getA); 
 Ti.API.debug( typeof foo1.getB); 
 Ti.API.debug( typeof foo1.geA); 
 Ti.API.debug( typeof foo1.ge); 
 Ti.API.debug("------"); 

 var foo2 = Ti.UI.createView({}); 
 Ti.API.debug( typeof foo2.hallo); 
 Ti.API.debug( typeof foo2.getA); 
 Ti.API.debug( typeof foo2.getB); 
 Ti.API.debug( typeof foo2.geA); 
 Ti.API.debug( typeof foo2.ge); 
 Ti.API.debug("------"); 
 

Output:

 
 [debug] undefined 
 [debug] undefined 
 [debug] undefined 
 [debug] undefined 
 [debug] undefined 
 [debug] ------ 
 [debug] undefined 
 [debug] function 
 [debug] function 
 [debug] undefined 
 [debug] undefined 
 [debug] ------ 
 

No issue under Android.

Additional debugging:

	var foo2 = Ti.UI.createView({});
	try {
		Ti.API.debug( typeof foo2.hallo());
	} catch(e) {
		Ti.API.error("couldn't resolve type");
	}
	try {
		Ti.API.debug( typeof foo2.getA());
	} catch(e) {
		Ti.API.error("couldn't resolve type");
	}
	try {
		Ti.API.debug( typeof foo2.getB());
	} catch(e) {
		Ti.API.error("couldn't resolve type");
	}
	try {
		Ti.API.debug( typeof foo2.geA());
	} catch(e) {
		Ti.API.error("couldn't resolve type");
	}
	try {
		Ti.API.debug( typeof foo2.ge());
	} catch(e) {
		Ti.API.error("couldn't resolve type");
	}
	Ti.API.debug("------");

Output:

[error] couldn't resolve type
[debug] undefined
[debug] undefined
[error] couldn't resolve type
[error] couldn't resolve type
[debug] ------

Comments

  1. Lee Morris 2017-06-26

    I am unable to reproduce the first issue, however I have managed to reproduce a similar error for the second issue. This is the error; [ERROR] : couldn't resolve type [ERROR] : couldn't resolve type [ERROR] : couldn't resolve type This was reproduced with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170623141152 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source