Bug 328187 - common supertype calculator ignores generics
Summary: common supertype calculator ignores generics
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: b3 (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 19:12 EDT by Henrik Lindberg CLA
Modified: 2017-09-13 11:51 EDT (History)
0 users

See Also:


Attachments

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