equal
deleted
inserted
replaced
25 |
25 |
26 package com.sun.tools.javac.comp; |
26 package com.sun.tools.javac.comp; |
27 |
27 |
28 import com.sun.tools.javac.code.Type.UndetVar.UndetVarListener; |
28 import com.sun.tools.javac.code.Type.UndetVar.UndetVarListener; |
29 import com.sun.tools.javac.code.Types.TypeMapping; |
29 import com.sun.tools.javac.code.Types.TypeMapping; |
|
30 import com.sun.tools.javac.comp.Attr.CheckMode; |
30 import com.sun.tools.javac.tree.JCTree; |
31 import com.sun.tools.javac.tree.JCTree; |
31 import com.sun.tools.javac.tree.JCTree.JCTypeCast; |
32 import com.sun.tools.javac.tree.JCTree.JCTypeCast; |
32 import com.sun.tools.javac.tree.TreeInfo; |
33 import com.sun.tools.javac.tree.TreeInfo; |
33 import com.sun.tools.javac.util.*; |
34 import com.sun.tools.javac.util.*; |
34 import com.sun.tools.javac.util.GraphUtils.DottableNode; |
35 import com.sun.tools.javac.util.GraphUtils.DottableNode; |
417 } else if (to.isPrimitive()) { |
418 } else if (to.isPrimitive()) { |
418 to = types.boxedClass(to).type; |
419 to = types.boxedClass(to).type; |
419 } |
420 } |
420 } else if (rsInfoInfContext.free(resultInfo.pt)) { |
421 } else if (rsInfoInfContext.free(resultInfo.pt)) { |
421 //propagation - cache captured vars |
422 //propagation - cache captured vars |
422 qtype = inferenceContext.asUndetVar(rsInfoInfContext.cachedCapture(tree, from, false)); |
423 qtype = inferenceContext.asUndetVar(rsInfoInfContext.cachedCapture(tree, from, !resultInfo.checkMode.updateTreeType())); |
423 } |
424 } |
424 Assert.check(allowGraphInference || !rsInfoInfContext.free(to), |
425 Assert.check(allowGraphInference || !rsInfoInfContext.free(to), |
425 "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); |
426 "legacy inference engine cannot handle constraints on both sides of a subtyping assertion"); |
426 //we need to skip capture? |
427 //we need to skip capture? |
427 Warner retWarn = new Warner(); |
428 Warner retWarn = new Warner(); |
507 Type to, Attr.ResultInfo resultInfo, |
508 Type to, Attr.ResultInfo resultInfo, |
508 InferenceContext inferenceContext) { |
509 InferenceContext inferenceContext) { |
509 inferenceContext.solve(List.of(from.qtype), new Warner()); |
510 inferenceContext.solve(List.of(from.qtype), new Warner()); |
510 inferenceContext.notifyChange(); |
511 inferenceContext.notifyChange(); |
511 Type capturedType = resultInfo.checkContext.inferenceContext() |
512 Type capturedType = resultInfo.checkContext.inferenceContext() |
512 .cachedCapture(tree, from.getInst(), false); |
513 .cachedCapture(tree, from.getInst(), !resultInfo.checkMode.updateTreeType()); |
513 if (types.isConvertible(capturedType, |
514 if (types.isConvertible(capturedType, |
514 resultInfo.checkContext.inferenceContext().asUndetVar(to))) { |
515 resultInfo.checkContext.inferenceContext().asUndetVar(to))) { |
515 //effectively skip additional return-type constraint generation (compatibility) |
516 //effectively skip additional return-type constraint generation (compatibility) |
516 return syms.objectType; |
517 return syms.objectType; |
517 } |
518 } |