[m-rev.] for post-commit review: color in add_type.m

Julien Fischer jfischer at opturion.com
Sun May 12 02:24:49 AEST 2024


On Sat, 11 May 2024, Zoltan Somogyi wrote:

> Use color in add_type.m.
> 
> compiler/add_type.m:
>     Add color to the diagnostics generated by this module.
>
>     In a few cases, improve the wording of the diagnostic.

...

> diff --git a/compiler/add_type.m b/compiler/add_type.m
> index cb7fe3459..55032f31a 100644
> --- a/compiler/add_type.m
> +++ b/compiler/add_type.m
> @@ -1050,11 +1065,13 @@ add_type_defn_ctor(Ctor, TypeCtor, TypeCtorModuleName, TVarSet,
>              OtherConsDefn ^ cons_type_ctor = TypeCtor
>          )
>      then
> -        QualifiedConsIdStr = cons_id_and_arity_to_string(QualifiedConsIdA),
> -        TypeCtorStr = type_ctor_to_string(TypeCtor),
> -        Pieces = [words("Error: constructor"), quote(QualifiedConsIdStr),
> -            words("for type"), quote(TypeCtorStr),
> -            words("multiply defined."), nl],
> +        Pieces = [words("Error: the")] ++
> +            color_as_subject([words("constructor"),
> +                unqual_cons_id_and_maybe_arity(QualifiedConsIdA)]) ++
> +            color_as_incorrect([words("occurs more than once")]) ++
> +            [words("in the definition of type constructor")] ++

I would delete the word "constructor" there.

> +            color_as_subject([unqual_type_ctor(TypeCtor), suffix(".")]) ++
> +            [nl],
>          Spec = spec($pred, severity_error, phase_pt2h, Context, Pieces),
>          !:Specs = [Spec | !.Specs]
>      else

The diff looks fine otherwise.

Julien.


More information about the reviews mailing list