Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 324552 - TupleType lubTupleTypes method has a bug in the fieldNames logic.
Summary: TupleType lubTupleTypes method has a bug in the fieldNames logic.
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: IMP (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Robert M. Fuhrer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-06 04:44 EDT by Mark Hills CLA
Modified: 2014-01-09 15:03 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.