2695 } |
2695 } |
2696 |
2696 |
2697 Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null; |
2697 Pair<Symbol, Resolve.ReferenceLookupHelper> refResult = null; |
2698 List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save(); |
2698 List<Type> saved_undet = resultInfo.checkContext.inferenceContext().save(); |
2699 try { |
2699 try { |
2700 refResult = rs.resolveMemberReference(that.pos(), localEnv, that, that.expr.type, |
2700 refResult = rs.resolveMemberReference(localEnv, that, that.expr.type, |
2701 that.name, argtypes, typeargtypes, true, referenceCheck, |
2701 that.name, argtypes, typeargtypes, referenceCheck, |
2702 resultInfo.checkContext.inferenceContext()); |
2702 resultInfo.checkContext.inferenceContext(), |
|
2703 resultInfo.checkContext.deferredAttrContext().mode); |
2703 } finally { |
2704 } finally { |
2704 resultInfo.checkContext.inferenceContext().rollback(saved_undet); |
2705 resultInfo.checkContext.inferenceContext().rollback(saved_undet); |
2705 } |
2706 } |
2706 |
2707 |
2707 Symbol refSym = refResult.fst; |
2708 Symbol refSym = refResult.fst; |
2766 if (that.getMode() == ReferenceMode.INVOKE && |
2768 if (that.getMode() == ReferenceMode.INVOKE && |
2767 TreeInfo.isStaticSelector(that.expr, names) && |
2769 TreeInfo.isStaticSelector(that.expr, names) && |
2768 that.kind.isUnbound() && |
2770 that.kind.isUnbound() && |
2769 !desc.getParameterTypes().head.isParameterized()) { |
2771 !desc.getParameterTypes().head.isParameterized()) { |
2770 chk.checkRaw(that.expr, localEnv); |
2772 chk.checkRaw(that.expr, localEnv); |
2771 } |
|
2772 |
|
2773 if (!that.kind.isUnbound() && |
|
2774 that.getMode() == ReferenceMode.INVOKE && |
|
2775 TreeInfo.isStaticSelector(that.expr, names) && |
|
2776 !that.sym.isStatic()) { |
|
2777 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), |
|
2778 diags.fragment("non-static.cant.be.ref", Kinds.kindName(refSym), refSym)); |
|
2779 result = that.type = types.createErrorType(target); |
|
2780 return; |
|
2781 } |
|
2782 |
|
2783 if (that.kind.isUnbound() && |
|
2784 that.getMode() == ReferenceMode.INVOKE && |
|
2785 TreeInfo.isStaticSelector(that.expr, names) && |
|
2786 that.sym.isStatic()) { |
|
2787 log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), |
|
2788 diags.fragment("static.method.in.unbound.lookup", Kinds.kindName(refSym), refSym)); |
|
2789 result = that.type = types.createErrorType(target); |
|
2790 return; |
|
2791 } |
2773 } |
2792 |
2774 |
2793 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) && |
2775 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) && |
2794 exprType.getTypeArguments().nonEmpty()) { |
2776 exprType.getTypeArguments().nonEmpty()) { |
2795 //static ref with class type-args |
2777 //static ref with class type-args |