1523 public final void addBound(InferenceBound ib, Type bound, Types types) { |
1523 public final void addBound(InferenceBound ib, Type bound, Types types) { |
1524 addBound(ib, bound, types, false); |
1524 addBound(ib, bound, types, false); |
1525 } |
1525 } |
1526 |
1526 |
1527 protected void addBound(InferenceBound ib, Type bound, Types types, boolean update) { |
1527 protected void addBound(InferenceBound ib, Type bound, Types types, boolean update) { |
1528 Type bound2 = boundMap.apply(bound); |
1528 Type bound2 = toTypeVarMap.apply(bound); |
1529 List<Type> prevBounds = bounds.get(ib); |
1529 List<Type> prevBounds = bounds.get(ib); |
1530 for (Type b : prevBounds) { |
1530 for (Type b : prevBounds) { |
1531 //check for redundancy - use strict version of isSameType on tvars |
1531 //check for redundancy - use strict version of isSameType on tvars |
1532 //(as the standard version will lead to false positives w.r.t. clones ivars) |
1532 //(as the standard version will lead to false positives w.r.t. clones ivars) |
1533 if (types.isSameType(b, bound2, true) || bound == qtype) return; |
1533 if (types.isSameType(b, bound2, true) || bound == qtype) return; |
1534 } |
1534 } |
1535 bounds.put(ib, prevBounds.prepend(bound2)); |
1535 bounds.put(ib, prevBounds.prepend(bound2)); |
1536 notifyChange(EnumSet.of(ib)); |
1536 notifyChange(EnumSet.of(ib)); |
1537 } |
1537 } |
1538 //where |
1538 //where |
1539 Type.Mapping boundMap = new Mapping("boundMap") { |
1539 Type.Mapping toTypeVarMap = new Mapping("toTypeVarMap") { |
1540 @Override |
1540 @Override |
1541 public Type apply(Type t) { |
1541 public Type apply(Type t) { |
1542 if (t.hasTag(UNDETVAR)) { |
1542 if (t.hasTag(UNDETVAR)) { |
1543 UndetVar uv = (UndetVar)t; |
1543 UndetVar uv = (UndetVar)t; |
1544 return uv.inst != null ? uv.inst : uv.qtype; |
1544 return uv.inst != null ? uv.inst : uv.qtype; |