if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) ||
checkContext.compatible(owntype, funcInterface, types.noWarnings); return owntype;
if (!resultInfo.checkContext.compatible(qtype1, resultInfo.checkContext.inferenceContext().asFree(to), retWarn) ||
Type checkType(final DiagnosticPosition pos, final Type found, final Type req, final CheckContext checkContext) { final Infer.InferenceContext inferenceContext = checkContext.inferenceContext(); if (inferenceContext.free(req)) { inferenceContext.addFreeTypeListener(List.of(req), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { checkType(pos, inferenceContext.asInstType(found), inferenceContext.asInstType(req), checkContext); } }); } if (req.hasTag(ERROR)) return req; if (req.hasTag(NONE)) return found; if (checkContext.compatible(found, req, checkContext.checkWarner(pos, found, req))) { return found; } else { if (found.isNumeric() && req.isNumeric()) { checkContext.report(pos, diags.fragment("possible.loss.of.precision", found, req)); return types.createErrorType(found); } checkContext.report(pos, diags.fragment("inconvertible.types", found, req)); return types.createErrorType(found); } }
Type checkType(final DiagnosticPosition pos, final Type found, final Type req, final CheckContext checkContext) { final Infer.InferenceContext inferenceContext = checkContext.inferenceContext(); if (inferenceContext.free(req) || inferenceContext.free(found)) { inferenceContext.addFreeTypeListener(List.of(req, found), new FreeTypeListener() { @Override public void typesInferred(InferenceContext inferenceContext) { checkType(pos, inferenceContext.asInstType(found), inferenceContext.asInstType(req), checkContext); } }); } if (req.hasTag(ERROR)) return req; if (req.hasTag(NONE)) return found; if (checkContext.compatible(found, req, checkContext.checkWarner(pos, found, req))) { return found; } else { if (found.isNumeric() && req.isNumeric()) { checkContext.report(pos, diags.fragment("possible.loss.of.precision", found, req)); return types.createErrorType(found); } checkContext.report(pos, diags.fragment("inconvertible.types", found, req)); return types.createErrorType(found); } }
public boolean compatible(Type found, Type req, Warner warn) { return enclosingContext.compatible(found, req, warn); }
public boolean compatible(Type found, Type req, Warner warn) { return enclosingContext.compatible(found, req, warn); }
@Override public boolean compatible(Type found, Type req, Warner warn) { //return type must be compatible in both current context and assignment context return chk.basicHandler.compatible(found, inferenceContext().asUndetVar(req), warn); }
@Override public boolean compatible(Type found, Type req, Warner warn) { //return type must be compatible in both current context and assignment context return chk.basicHandler.compatible(found, inferenceContext().asFree(req), warn); }