[m-rev.] for review: more expressive warning for subtype order mismatch

Zoltan Somogyi zoltan.somogyi at runbox.com
Sat Jul 3 21:52:29 AEST 2021


2021-07-03 16:22 GMT+10:00 "Peter Wang" <novalazy at gmail.com>:
>> -compute_subtype_ctors_out_of_order(Ctors, SuperCtors, CtorsOutOfOrder) :-
>> +compute_subtype_ctors_out_of_order(Ctors, SuperCtors, OutOfOrderPieces) :-
>>      (
>> -        Ctors = [],
>> -        CtorsOutOfOrder = []
>> -    ;
>> -        Ctors = [_],
>> -        CtorsOutOfOrder = []
>> +        ( Ctors = []
>> +        ; Ctors = [_]
>> +        ),
>> +        OutOfOrderPieces = []
>>      ;
>>          Ctors = [_, _ | _],
>> -        list.map(ctor_to_unqual_sym_name_arity, Ctors, CtorNames0),
>> -        list.map(ctor_to_unqual_sym_name_arity, SuperCtors, SuperCtorNames),
>> -        list.filter(list.contains(SuperCtorNames), CtorNames0, CtorNames),
>> +        list.map(ctor_to_string, Ctors, CtorStrs0),
>> +        list.map(ctor_to_string, SuperCtors, SuperCtorStrs0),
>> +        list.filter(list.contains(SuperCtorStrs0), CtorStrs0, CtorStrs),
>> +        list.filter(list.contains(CtorStrs0), SuperCtorStrs0, SuperCtorStrs),
>>          EditParams = edit_params(1, 1, 1),
>> -        find_shortest_edit_seq(EditParams, SuperCtorNames, CtorNames, EditSeq),
>> -        list.filter_map(edit_to_ctor_out_of_order, EditSeq, CtorsOutOfOrder)
>> +        find_shortest_edit_seq(EditParams, SuperCtorStrs, CtorStrs, EditSeq),
>> +        find_diff_seq(SuperCtorStrs, EditSeq, DiffSeq),
>> +        find_change_hunks(3, DiffSeq, CHunks),
>> +        list.map(change_hunk_to_pieces, CHunks, OutOfOrderPiecesLists),
>> +        list.condense(OutOfOrderPiecesLists, OutOfOrderPieces)
>>      ).
> 
> CHunks

I am guessing this comment, and the next, are objecting to the variable name,
so I changed it to ChangeHunk.

> That's fine. The chunk header seems pointless in this example,
> but I guess it serves as a separator if there are multiple chunks.

That is one situation in which a header is needed. The other is
when some ctors are not shown, because they are not within
three positions of an inserted or deleted ctor. Neither situation
occurs to this test case.

Thanks for the review.

Zoltan.


More information about the reviews mailing list