[m-rev.] diff: expand an acronym in an error message

Julien Fischer jfischer at opturion.com
Wed Mar 15 12:04:01 AEDT 2017


Expand an acronym in an error message.

compiler/parse_type_defn.m:
     Expand "LHS" in the error message for type variables on the
     left hand side of an type definition.

tests/invalid/Mmakfile:
tests/invalid/type_lhs_var.{m,err_exp}:
      Add a test case for the above error message.

Julien.

diff --git a/compiler/parse_type_defn.m b/compiler/parse_type_defn.m
index 81de137..3711c49 100644
--- a/compiler/parse_type_defn.m
+++ b/compiler/parse_type_defn.m
@@ -1390,7 +1390,10 @@ parse_type_defn_head(ParseContext, ModuleName, VarSet, HeadTerm,
          HeadTerm = term.variable(Var, Context),
          (
              ParseContext = tdhpc_type_defn,
-            Pieces = [words("Error: variable on LHS of type definition."), nl]
+            Pieces = [
+                words("Error: variable on left hand side of type definition."),
+                nl
+            ]
          ;
              ParseContext = tdhpc_foreign_type_pragma(ContextPieces),
              VarName = varset.lookup_name(VarSet, Var),
diff --git a/tests/invalid/Mmakefile b/tests/invalid/Mmakefile
index 0ca0932..88bd70d 100644
--- a/tests/invalid/Mmakefile
+++ b/tests/invalid/Mmakefile
@@ -270,6 +270,7 @@ SINGLEMODULE= \
  	type_error_ambiguous \
  	type_error_in_arg \
  	type_inf_loop \
+	type_lhs_var \
  	type_loop \
  	type_mismatch \
  	type_vars \
diff --git a/tests/invalid/type_lhs_var.err_exp b/tests/invalid/type_lhs_var.err_exp
index e69de29..a0c21cc 100644
--- a/tests/invalid/type_lhs_var.err_exp
+++ b/tests/invalid/type_lhs_var.err_exp
@@ -0,0 +1,2 @@
+type_lhs_var.m:006: Error: variable on left hand side of type definition.
+type_lhs_var.m:008: Error: variable on left hand side of type definition.
diff --git a/tests/invalid/type_lhs_var.m b/tests/invalid/type_lhs_var.m
index e69de29..8547b67 100644
--- a/tests/invalid/type_lhs_var.m
+++ b/tests/invalid/type_lhs_var.m
@@ -0,0 +1,8 @@
+:- module type_lhs_var.
+:- interface.
+
+:- type foo == int.
+
+:- type A == int.
+
+:- type B ---> foo ; bar.


More information about the reviews mailing list