“4300f0cdaa576486dacf412fb19606bd9dbdcaaf”上不存在“projects/securego/imports.yml”
提交 0b21abd0 编写于 作者: M mcimadamore

8009545: Graph inference: dependencies between inference variables should be...

8009545: Graph inference: dependencies between inference variables should be set during incorporation
Summary: Move all transitivity checks into the incorporation round
Reviewed-by: jjg
上级 18851104
...@@ -1367,7 +1367,7 @@ public class Type implements PrimitiveType { ...@@ -1367,7 +1367,7 @@ public class Type implements PrimitiveType {
for (Type b : prevBounds) { for (Type b : prevBounds) {
//check for redundancy - use strict version of isSameType on tvars //check for redundancy - use strict version of isSameType on tvars
//(as the standard version will lead to false positives w.r.t. clones ivars) //(as the standard version will lead to false positives w.r.t. clones ivars)
if (types.isSameType(b, bound2, true)) return; if (types.isSameType(b, bound2, true) || bound == qtype) return;
} }
bounds.put(ib, prevBounds.prepend(bound2)); bounds.put(ib, prevBounds.prepend(bound2));
notifyChange(EnumSet.of(ib)); notifyChange(EnumSet.of(ib));
......
...@@ -641,6 +641,8 @@ public class Infer { ...@@ -641,6 +641,8 @@ public class Infer {
if (inferenceContext.inferenceVars().contains(b)) { if (inferenceContext.inferenceVars().contains(b)) {
UndetVar uv2 = (UndetVar)inferenceContext.asFree(b); UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
//alpha <: beta //alpha <: beta
//0. set beta :> alpha
uv2.addBound(InferenceBound.LOWER, uv.qtype, infer.types);
//1. copy alpha's lower to beta's //1. copy alpha's lower to beta's
for (Type l : uv.getBounds(InferenceBound.LOWER)) { for (Type l : uv.getBounds(InferenceBound.LOWER)) {
uv2.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types); uv2.addBound(InferenceBound.LOWER, inferenceContext.asInstType(l), infer.types);
...@@ -664,6 +666,8 @@ public class Infer { ...@@ -664,6 +666,8 @@ public class Infer {
if (inferenceContext.inferenceVars().contains(b)) { if (inferenceContext.inferenceVars().contains(b)) {
UndetVar uv2 = (UndetVar)inferenceContext.asFree(b); UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
//alpha :> beta //alpha :> beta
//0. set beta <: alpha
uv2.addBound(InferenceBound.UPPER, uv.qtype, infer.types);
//1. copy alpha's upper to beta's //1. copy alpha's upper to beta's
for (Type u : uv.getBounds(InferenceBound.UPPER)) { for (Type u : uv.getBounds(InferenceBound.UPPER)) {
uv2.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types); uv2.addBound(InferenceBound.UPPER, inferenceContext.asInstType(u), infer.types);
...@@ -687,6 +691,8 @@ public class Infer { ...@@ -687,6 +691,8 @@ public class Infer {
if (inferenceContext.inferenceVars().contains(b)) { if (inferenceContext.inferenceVars().contains(b)) {
UndetVar uv2 = (UndetVar)inferenceContext.asFree(b); UndetVar uv2 = (UndetVar)inferenceContext.asFree(b);
//alpha == beta //alpha == beta
//0. set beta == alpha
uv2.addBound(InferenceBound.EQ, uv.qtype, infer.types);
//1. copy all alpha's bounds to beta's //1. copy all alpha's bounds to beta's
for (InferenceBound ib : InferenceBound.values()) { for (InferenceBound ib : InferenceBound.values()) {
for (Type b2 : uv.getBounds(ib)) { for (Type b2 : uv.getBounds(ib)) {
...@@ -1228,10 +1234,6 @@ public class Infer { ...@@ -1228,10 +1234,6 @@ public class Infer {
if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) { if (Type.containsAny(uv_i.getBounds(InferenceBound.values()), List.of(j))) {
//update i's deps //update i's deps
n_i.deps.add(n_j); n_i.deps.add(n_j);
//update j's deps - only if i's bounds contain _exactly_ j
if (uv_i.getBounds(InferenceBound.values()).contains(j)) {
n_j.deps.add(n_i);
}
} }
} }
} }
......
TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String,X, java.lang.Object,java.lang.Number) TargetType28.java:20:32: compiler.err.prob.found.req: (compiler.misc.incompatible.eq.upper.bounds: X, java.lang.String,R, java.lang.Object,java.lang.Number)
1 error 1 error
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册