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

Bug 324552

Summary: TupleType lubTupleTypes method has a bug in the fieldNames logic.
Product: z_Archived Reporter: Mark Hills <Mark.Hills>
Component: IMPAssignee: Robert M. Fuhrer <rfuhrer>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Mark Hills CLA 2010-09-06 04:44:41 EDT
Build Identifier: 20100218-1602

The lubTupleTypes method uses t1.hasFieldNames() to check if the types included in t1 have field names, using those for the lub type if that is the case. It then mistakenly uses t1.hasFieldNames() to check this for t2 in the case where t1 has no field names. The following patch fixes this:

Index: src/org/eclipse/imp/pdb/facts/type/TupleType.java
===================================================================
--- src/org/eclipse/imp/pdb/facts/type/TupleType.java	(revision 22656)
+++ src/org/eclipse/imp/pdb/facts/type/TupleType.java	(working copy)
@@ -177,7 +177,7 @@
     		if (t1.hasFieldNames()) {
     			fieldNames[i] = t1.getFieldName(i);
     		}
-    		else if (t1.hasFieldNames()) {
+    		else if (t2.hasFieldNames()) {
     			fieldNames[i] = t2.getFieldName(i);
     		}
     	}


Reproducible: Always

Steps to Reproduce:
No specific problem noted, but this should mean that, in cases where t1 has no field names but t2 does, those field names would never be used.