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

Bug 328187

Summary: common supertype calculator ignores generics
Product: z_Archived Reporter: Henrik Lindberg <henrik.lindberg>
Component: b3Assignee: Project Inbox <b3.engine-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Henrik Lindberg CLA 2010-10-19 19:12:34 EDT
When type inference calculates the common super type it ignores generics.

var a = [ ["a", "b"] ["c", "d"];

produces a variable of type List<List> and not List<List<String>>

The failing logic is in: org.eclipse.b3.backend.evaluator.typesystem.TypeDistance.getMostSpecificCommonType(Type[])
Comment 1 Henrik Lindberg CLA 2010-10-19 19:14:44 EDT
Also see bug 328186 describing that it is also not possible to declare List<List<String>>.
Taken together this is not good, and type casting is required part by part with intermediate variables.
Comment 2 Henrik Lindberg CLA 2010-10-19 19:29:32 EDT
The b3 test testWithContext.b3 suffers from this as there is a syntax error caused by the lack of inference.
The test evaluates ok (as it should) but there are syntax error markers when editing (because of bug 328182 - all syntax errors are not flagged by junit runner).