2706 desc = fallbackDescriptorType(that); |
2706 desc = fallbackDescriptorType(that); |
2707 } |
2707 } |
2708 |
2708 |
2709 setFunctionalInfo(that, pt(), desc, target, resultInfo.checkContext.inferenceContext()); |
2709 setFunctionalInfo(that, pt(), desc, target, resultInfo.checkContext.inferenceContext()); |
2710 List<Type> argtypes = desc.getParameterTypes(); |
2710 List<Type> argtypes = desc.getParameterTypes(); |
2711 |
2711 Resolve.MethodCheck referenceCheck = rs.resolveMethodCheck; |
2712 Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = |
2712 |
2713 rs.resolveMemberReference(that.pos(), localEnv, that, |
2713 if (resultInfo.checkContext.inferenceContext().free(argtypes)) { |
2714 that.expr.type, that.name, argtypes, typeargtypes, true, rs.resolveMethodCheck); |
2714 referenceCheck = rs.new MethodReferenceCheck(resultInfo.checkContext.inferenceContext()); |
|
2715 } |
|
2716 |
|
2717 Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null; |
|
2718 List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save(); |
|
2719 try { |
|
2720 refResult = rs.resolveMemberReference(that.pos(), localEnv, that, that.expr.type, |
|
2721 that.name, argtypes, typeargtypes, true, referenceCheck, |
|
2722 resultInfo.checkContext.inferenceContext()); |
|
2723 } finally { |
|
2724 resultInfo.checkContext.inferenceContext().rollback(saved_undet); |
|
2725 } |
2715 |
2726 |
2716 Symbol refSym = refResult.fst; |
2727 Symbol refSym = refResult.fst; |
2717 Resolve.ReferenceLookupHelper lookupHelper = refResult.snd; |
2728 Resolve.ReferenceLookupHelper lookupHelper = refResult.snd; |
2718 |
2729 |
2719 if (refSym.kind != MTH) { |
2730 if (refSym.kind != MTH) { |
2821 // Check that super-qualified symbols are not abstract (JLS) |
2832 // Check that super-qualified symbols are not abstract (JLS) |
2822 rs.checkNonAbstract(that.pos(), that.sym); |
2833 rs.checkNonAbstract(that.pos(), that.sym); |
2823 } |
2834 } |
2824 } |
2835 } |
2825 |
2836 |
2826 that.sym = refSym.baseSymbol(); |
|
2827 that.kind = lookupHelper.referenceKind(that.sym); |
|
2828 |
|
2829 ResultInfo checkInfo = |
2837 ResultInfo checkInfo = |
2830 resultInfo.dup(newMethodTemplate( |
2838 resultInfo.dup(newMethodTemplate( |
2831 desc.getReturnType().hasTag(VOID) ? Type.noType : desc.getReturnType(), |
2839 desc.getReturnType().hasTag(VOID) ? Type.noType : desc.getReturnType(), |
2832 lookupHelper.argtypes, |
2840 that.kind.isUnbound() ? argtypes.tail : argtypes, typeargtypes)); |
2833 typeargtypes)); |
|
2834 |
2841 |
2835 Type refType = checkId(that, lookupHelper.site, refSym, localEnv, checkInfo); |
2842 Type refType = checkId(that, lookupHelper.site, refSym, localEnv, checkInfo); |
|
2843 |
|
2844 if (that.kind.isUnbound() && |
|
2845 resultInfo.checkContext.inferenceContext().free(argtypes.head)) { |
|
2846 //re-generate inference constraints for unbound receiver |
|
2847 if (!types.isSubtype(resultInfo.checkContext.inferenceContext().asFree(argtypes.head), exprType)) { |
|
2848 //cannot happen as this has already been checked - we just need |
|
2849 //to regenerate the inference constraints, as that has been lost |
|
2850 //as a result of the call to inferenceContext.save() |
|
2851 Assert.error("Can't get here"); |
|
2852 } |
|
2853 } |
2836 |
2854 |
2837 if (!refType.isErroneous()) { |
2855 if (!refType.isErroneous()) { |
2838 refType = types.createMethodTypeWithReturn(refType, |
2856 refType = types.createMethodTypeWithReturn(refType, |
2839 adjustMethodReturnType(lookupHelper.site, that.name, checkInfo.pt.getParameterTypes(), refType.getReturnType())); |
2857 adjustMethodReturnType(lookupHelper.site, that.name, checkInfo.pt.getParameterTypes(), refType.getReturnType())); |
2840 } |
2858 } |