Community
Participate
Working Groups
Failures in BindingAmbiguities1.test731_ambiguousBinding7() f. show that the generated liftTo methods create a role object in a specific situation where actually a LiftingFailedException should be thrown. This problem was probably introduced by the change from using base class tags towards using instanceof or "getClass() == xy" checks. In test731_ambiguousBinding7() a T731ab7_3 is wrongly lifted to a Role731ab7_3 (despite the ambiguity to Role731ab7_4). This happends because the Role731ab7_2 branch (OK using exact type comparison) blindly OR-s instanceof checks for all known subBases (here T731ab7_3). Attempts to fix the above caused that test731_ambiguousBinding9() wrongly throws a LiftingFailedException. Here, T731ab9_4 is an acceptable subclass of T731ab9_2. This shows that indeed instanceof checks are required at some point, though in combination with other checks as to *exclude* the ambiguous subclass T731ab9_3.
Created attachment 181341 [details] fix Fixed by actually performing a simplification: - no longer filter ambiguous roles from the array of relevant roles - do not use exact type checks but rely on the order of generated instanceof checks: most specifics come first + add explicit case statements for throwing LiftingFailedException if an ambiguous base is the most specific match.
Created attachment 181585 [details] additional fix More fixes: - Sorting must consider roles (fully connected hierarchy) and bases (hierarchy may contain holes) fixes regression in BindingAmbiguitiesM.test73M_ambiguousBinding2() - simplify generated code by avoiding duplicates in relevantRoles (use set instead of list) also avoid adding nulls to simplify iterating Other related fixes have been committed as: r974: fixed a regression (NPE) in test219_playedbyInheritance4, triggered (but not caused) by r967 r975 fix regression re test921_hasRoleMethod5c2 -> more precise analysis of when binding ambiguity is relevant (consider base & static role type).
With all listed fixes all tests pass again, marking as fixed.
Verified for 0.8 M3 using build 201011100445 (by inspecting tests in BindingAmbiguities*).