Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357385

Summary: ISA against literals and smallInt variable returning wrong results
Product: z_Archived Reporter: Kathy Carroll <carrollk>
Component: EDTAssignee: Project Inbox <edt.javagen-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jeffdouglas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Kathy Carroll CLA 2011-09-12 10:16:37 EDT
Testing string and smallint literals with ISA gives the wrong results. Using isa against a variable declared as Smallint fails.

I'm uncertain what I should be expecting for the last variation.

=========  EGL code ==============
program driver type BasicProgram {}

	function main()
		result boolean;
		generic any?;
		mine smallint = 34;
		result = generic isa smallint;
		showResults("generic/null isa smallint", result, false);
		result = "literal" isa String;
		showResults("literal isaString", result, true);
		result = 34 isa String;
		showResults("34 isa String", result, false);
		result = 34 isa Any;
		showResults("34 isa Any", result, false);
		result = 34 isa int;
		showResults("34 isa int", result, false);
		result = 34 isa smallint;
		showResults("34 isa smallint", result, true);
		result = 34 isa float;
		showResults("34 isa float", result, false);
		result = 34 isa bigint;
		showResults("34 isa bigint", result, false);
		generic = 34;
		result = generic isa smallint;
		showResults("generic/literal isa smallint", result, true);
		result = mine isa smallint;
		showResults("mine/variable isa smallint", result, true);
		generic = mine;
		result = generic isa smallint;
		showResults("generic/variable isa smallint", result, true);
		result = 23.423 isa decimal(5,3);
		showResults("23.423 isa decimal(5,3)", result, true);
		result = 23.423 isa decimal(7,3);
		showResults("23.423 isa decimal(7,3)", result, false);
		reference decimal;
		reference = 23.234;
		result = reference isa decimal(5,3);
		showResults("reference isa decimal", result, true);		
		result = 23.423 isa decimal;
		showResults("23.423 isa decimal", result, false);
	end
	
	function showResults(variation string in, actual boolean in, expecting boolean in)
		if (actual != expecting)
			syslib.writestdout("failed " + variation);
		else
			syslib.writestdout("passed");
		end
	end
	
end
Comment 1 Kathy Carroll CLA 2011-09-12 12:46:19 EDT
add these variations
		result = 34767 isa int;
		showResults("34767 isa int", result, true);
		result = 2147483650 isa bigint;
		showResults("2147483650 isa bigint", result, true);
Comment 2 Jeff Douglas CLA 2011-09-12 14:01:50 EDT
Fixed in the runtime
Comment 3 Kathy Carroll CLA 2011-09-16 14:17:55 EDT
Last variation should be true cause all.  123.45 isa decimal

works in 201109161325
Comment 4 Lisa Lasher CLA 2011-10-11 16:12:00 EDT
Closing this defect.
Comment 5 Lisa Lasher CLA 2011-10-11 16:29:46 EDT
Closing this defect.