Commit Graph

1 Commits

Author SHA1 Message Date
Zoltan Somogyi
10da1dcdd0 Fix nonlocal typeclass_infos in rhs_lambda_goals.
This fixes github bug #98.

compiler/polymorphism.m:
    Compiling gh98.m used to cause a compiler crash when the compiler
    tried to look up info about a typeclass_info variable that was needed
    in a call inside a lambda goal, but was not created inside the lambda goal.
    It should therefore have been listed as a nonlocal of the lambda goal,
    but it was not, because none of the variables inside the lambda goal
    had the typeclass constraint represented by that typeclass_info var
    on their types. And since later invocations of quantification may
    reduce, but may not expand, the set of nonlocals in a rhs_lambda_goal
    (as opposed to the nonlocals set of the unification whose RHS consists
    of that rhs_lambda_goal), this problem stuck.

    Fix this underestimation of the final lambda nonlocals set by including
    in it all typeinfo and/or typeclass_info vars in the updated lambda goal.
    Since this may then result in an overestimation, set a flag to force
    a requantification of the whole procedure body once its polymorphism
    transformation has been completed.

compiler/polymorphism_info.m:
    Add a flag to force requantification.

compiler/goal_util.m:
    Fix a misleading predicate name.

compiler/hlds_goal.m:
    Fix documentation of rhs_lambda_goal.

compiler/hlds_out_goal.m:
    Fix a layout problem in HLDS dumps.

compiler/hlds_pred.m:
compiler/lambda.m:
    Fix misleading variable names.

tests/valid/gh98.m:
    Add the github test case.

tests/valid/Mmakefile:
    Enable the new test case.
2021-08-20 20:05:38 +10:00