[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[COMMITTED] pkl: support for the APUSH and APOP operators
From: |
Jose E. Marchesi |
Subject: |
[COMMITTED] pkl: support for the APUSH and APOP operators |
Date: |
Wed, 09 Mar 2022 11:19:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
This new language construction allows to use arrays as stacks in an
efficient way.
2022-03-09 Jose E. Marchesi <jemarch@gnu.org>
* libpoke/pkl-tab.y: Define tokens APUSH and APOP, and add rules
for the operators.
* libpoke/pkl-lex.l: Rules for APUSH and APOP tokens.
* libpoke/pkl-ops.def: Define operators PKL_AST_OP_APUSH and
PKL_AST_OP_APOP.
* libpoke/pkl-typify.c (pkl_typify1_ps_op_apush): New handler.
(pkl_typify1_ps_op_apop): Likewise.
(pkl_phase_typify1): Register new handlers.
* libpoke/pkl-promo.c (pkl_promo_ps_op_apush): New handler.
(pkl_phase_promo): Register new handler.
* libpoke/pkl-gen.c (pkl_gen_ps_op_apush): New handler.
(pkl_gen_ps_op_apop): Likewise.
(pkl_phase_gen): Register new handlers.
* testsuite/poke.pkl/apush-diag-1.pk: New test.
* testsuite/poke.pkl/apop-diag-1.pk: Likewise.
* testsuite/poke.pkl/apush-diag-2.pk: Likewise.
* testsuite/poke.pkl/apush-diag-3.pk: Likewise.
* testsuite/poke.pkl/apush-1.pk: Likewise.
* testsuite/poke.pkl/apush-2.pk: Likewise.
* testsuite/poke.pkl/apop-1.pk: Likewise.
* testsuite/poke.pkl/apop-2.pk: Likewise.
* testsuite/Makefile.am (EXTRA_DIST): Add new tests.
* doc/poke.texi (Arrays as Stacks): New section.
---
ChangeLog | 26 +++++++++++++
doc/poke.texi | 36 +++++++++++++++++
libpoke/pkl-gen.c | 34 ++++++++++++++++
libpoke/pkl-lex.l | 2 +
libpoke/pkl-ops.def | 2 +
libpoke/pkl-promo.c | 26 +++++++++++++
libpoke/pkl-tab.y | 14 +++++++
libpoke/pkl-typify.c | 80 ++++++++++++++++++++++++++++++++++++++
testsuite/Makefile.am | 8 ++++
testsuite/poke.pkl/apop-1.pk | 4 ++
testsuite/poke.pkl/apop-2.pk | 4 ++
testsuite/poke.pkl/apop-diag-1.pk | 5 +++
testsuite/poke.pkl/apush-1.pk | 4 ++
testsuite/poke.pkl/apush-2.pk | 4 ++
testsuite/poke.pkl/apush-diag-1.pk | 5 +++
testsuite/poke.pkl/apush-diag-2.pk | 5 +++
testsuite/poke.pkl/apush-diag-3.pk | 5 +++
17 files changed, 264 insertions(+)
create mode 100644 testsuite/poke.pkl/apop-1.pk
create mode 100644 testsuite/poke.pkl/apop-2.pk
create mode 100644 testsuite/poke.pkl/apop-diag-1.pk
create mode 100644 testsuite/poke.pkl/apush-1.pk
create mode 100644 testsuite/poke.pkl/apush-2.pk
create mode 100644 testsuite/poke.pkl/apush-diag-1.pk
create mode 100644 testsuite/poke.pkl/apush-diag-2.pk
create mode 100644 testsuite/poke.pkl/apush-diag-3.pk
diff --git a/ChangeLog b/ChangeLog
index 986a02cf..d9492dae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2022-03-09 Jose E. Marchesi <jemarch@gnu.org>
+
+ * libpoke/pkl-tab.y: Define tokens APUSH and APOP, and add rules
+ for the operators.
+ * libpoke/pkl-lex.l: Rules for APUSH and APOP tokens.
+ * libpoke/pkl-ops.def: Define operators PKL_AST_OP_APUSH and
+ PKL_AST_OP_APOP.
+ * libpoke/pkl-typify.c (pkl_typify1_ps_op_apush): New handler.
+ (pkl_typify1_ps_op_apop): Likewise.
+ (pkl_phase_typify1): Register new handlers.
+ * libpoke/pkl-promo.c (pkl_promo_ps_op_apush): New handler.
+ (pkl_phase_promo): Register new handler.
+ * libpoke/pkl-gen.c (pkl_gen_ps_op_apush): New handler.
+ (pkl_gen_ps_op_apop): Likewise.
+ (pkl_phase_gen): Register new handlers.
+ * testsuite/poke.pkl/apush-diag-1.pk: New test.
+ * testsuite/poke.pkl/apop-diag-1.pk: Likewise.
+ * testsuite/poke.pkl/apush-diag-2.pk: Likewise.
+ * testsuite/poke.pkl/apush-diag-3.pk: Likewise.
+ * testsuite/poke.pkl/apush-1.pk: Likewise.
+ * testsuite/poke.pkl/apush-2.pk: Likewise.
+ * testsuite/poke.pkl/apop-1.pk: Likewise.
+ * testsuite/poke.pkl/apop-2.pk: Likewise.
+ * testsuite/Makefile.am (EXTRA_DIST): Add new tests.
+ * doc/poke.texi (Arrays as Stacks): New section.
+
2022-03-08 Jose E. Marchesi <jemarch@gnu.org>
* pickles/diff.pk: Document diff_structured.
diff --git a/doc/poke.texi b/doc/poke.texi
index b01c490f..d94cf3d9 100644
--- a/doc/poke.texi
+++ b/doc/poke.texi
@@ -10019,6 +10019,7 @@ Arrays are homogeneous collections of values.
* Array Elements:: Checking for array elements.
* Array Concatenation:: Concatenating the elements of arrays.
* Array Attributes:: Accessing properties of array values.
+* Arrays as Stacks:: Using arrays as stacks.
@end menu
@node Array Literals
@@ -10551,6 +10552,41 @@ If the provided index is out of bounds then
@code{E_out_of_bounds} is
raised.
@end table
+@node Arrays as Stacks
+@subsection Arrays as Stacks
+
+Array values can be manipulated as stacks using two operators:
+@code{apush} and @code{apop}.
+
+The @code{apush} operator gets an array and a value and appends the
+value into the array. Note it has a destructive side-effect in the
+array value, and also it returns the modified value:
+
+@example
+(poke) var a = [1,2,3]
+(poke) apush (a, 4)
+[1,2,3,4]
+(poke) a
+[1,2,3,4]
+@end example
+
+the @code{apop} operators gets an array and removes the last value of
+the array. If the given array is empty then @code{E_out_of_bounds} is
+raised. As with @code{apush}, the operation has the side effect of
+modifying the given array and also it returns the array value:
+
+@example
+(poke) var a = [1,2,3]
+(poke) apop (a)
+[0x1,0x2]
+(poke) apop (a)
+[0x1]
+(poke) apop (a)
+[]
+(poke) apop (a)
+unhandled out of bounds exception
+@end example
+
@node Structs
@section Structs
@cindex structs
diff --git a/libpoke/pkl-gen.c b/libpoke/pkl-gen.c
index c57460cb..b34af11c 100644
--- a/libpoke/pkl-gen.c
+++ b/libpoke/pkl-gen.c
@@ -4178,6 +4178,38 @@ PKL_PHASE_BEGIN_HANDLER (pkl_gen_pr_op_impl)
PKL_PHASE_END_HANDLER
/*
+ * | ARR
+ * | VAL
+ * APUSH
+ */
+
+PKL_PHASE_BEGIN_HANDLER (pkl_gen_ps_op_apush)
+{
+ /* Stack: ARR VAL */
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_SWAP); /* VAL ARR */
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_SEL); /* VAL ARR SEL */
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_ROT); /* ARR SEL VAL */
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_AINS); /* ARR */
+}
+PKL_PHASE_END_HANDLER
+
+/*
+ * | ARR
+ * APOP
+ */
+
+PKL_PHASE_BEGIN_HANDLER (pkl_gen_ps_op_apop)
+{
+ /* Stack: ARR */
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_SEL); /* ARR SEL */
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_PUSH, pvm_make_ulong (1, 64));
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_SUBLU);
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_NIP2);
+ pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_AREM); /* ARR */
+}
+PKL_PHASE_END_HANDLER
+
+/*
* EXCOND
* | EXP|STMT
* | EXCEPTION_ID
@@ -4630,6 +4662,8 @@ struct pkl_phase pkl_phase_gen =
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_BCONC, pkl_gen_ps_op_bconc),
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_UNMAP, pkl_gen_ps_op_unmap),
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_IN, pkl_gen_ps_op_in),
+ PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_APUSH, pkl_gen_ps_op_apush),
+ PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_APOP, pkl_gen_ps_op_apop),
PKL_PHASE_PR_OP_HANDLER (PKL_AST_OP_EXCOND, pkl_gen_pr_op_excond),
PKL_PHASE_PR_OP_HANDLER (PKL_AST_OP_TYPEOF, pkl_gen_pr_op_typeof),
PKL_PHASE_PS_TYPE_HANDLER (PKL_TYPE_VOID, pkl_gen_ps_type_void),
diff --git a/libpoke/pkl-lex.l b/libpoke/pkl-lex.l
index 41a066d5..29dbbc98 100644
--- a/libpoke/pkl-lex.l
+++ b/libpoke/pkl-lex.l
@@ -204,6 +204,8 @@ S ::
"if" { return IF; }
"sizeof" { return SIZEOF; }
"typeof" { return TYPEOF; }
+"apush" { return APUSH; }
+"apop" { return APOP; }
"fun" { return DEFUN; }
"method" { return METHOD; }
"type" { return DEFTYPE; }
diff --git a/libpoke/pkl-ops.def b/libpoke/pkl-ops.def
index 671a9160..b3ec3985 100644
--- a/libpoke/pkl-ops.def
+++ b/libpoke/pkl-ops.def
@@ -48,6 +48,7 @@ PKL_DEF_OP (PKL_AST_OP_IN, "IN")
PKL_DEF_OP (PKL_AST_OP_GCD, "GCD")
PKL_DEF_OP (PKL_AST_OP_IMPL, "IMPL")
PKL_DEF_OP (PKL_AST_OP_EXCOND, "EXCOND")
+PKL_DEF_OP (PKL_AST_OP_APUSH, "APUSH")
/* Unary operators. */
PKL_DEF_OP (PKL_AST_OP_PREINC, "PREINC")
@@ -62,6 +63,7 @@ PKL_DEF_OP (PKL_AST_OP_NEG, "NEG")
PKL_DEF_OP (PKL_AST_OP_BNOT, "BNOT")
PKL_DEF_OP (PKL_AST_OP_NOT, "NOT")
PKL_DEF_OP (PKL_AST_OP_UNMAP, "UNMAP")
+PKL_DEF_OP (PKL_AST_OP_APOP, "APOP")
/*
Local variables:
diff --git a/libpoke/pkl-promo.c b/libpoke/pkl-promo.c
index cacd18f1..91eb581e 100644
--- a/libpoke/pkl-promo.c
+++ b/libpoke/pkl-promo.c
@@ -1653,6 +1653,31 @@ PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_cast)
}
PKL_PHASE_END_HANDLER
+/* The second operand of an APUSH operation must be promoted to the
+ type of the elements of the first operator. */
+
+PKL_PHASE_BEGIN_HANDLER (pkl_promo_ps_op_apush)
+{
+ pkl_ast_node exp = PKL_PASS_NODE;
+ pkl_ast_node op1 = PKL_AST_EXP_OPERAND (exp, 0);
+ pkl_ast_node op1_type = PKL_AST_TYPE (op1);
+ pkl_ast_node op1_elem_type = PKL_AST_TYPE_A_ETYPE (op1_type);
+ int restart = 0;
+
+ if (!promote_node (PKL_PASS_AST,
+ &PKL_AST_EXP_OPERAND (PKL_PASS_NODE, 1),
+ op1_elem_type,
+ &restart))
+ {
+ PKL_ICE (PKL_AST_LOC (PKL_AST_EXP_OPERAND (PKL_PASS_NODE, 1)),
+ "couldn't promote argument to apush");
+ PKL_PASS_ERROR;
+ }
+
+ PKL_PASS_RESTART = restart;
+}
+PKL_PHASE_END_HANDLER
+
struct pkl_phase pkl_phase_promo =
{
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_EQ, pkl_promo_ps_op_rela),
@@ -1683,6 +1708,7 @@ struct pkl_phase pkl_phase_promo =
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_CEILDIV, pkl_promo_ps_op_div),
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_IN, pkl_promo_ps_op_in),
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_ATTR, pkl_promo_ps_op_attr),
+ PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_APUSH, pkl_promo_ps_op_apush),
PKL_PHASE_PS_HANDLER (PKL_AST_FUNC_ARG, pkl_promo_ps_func_arg),
PKL_PHASE_PS_HANDLER (PKL_AST_MAP, pkl_promo_ps_map),
PKL_PHASE_PS_HANDLER (PKL_AST_INDEXER, pkl_promo_ps_indexer),
diff --git a/libpoke/pkl-tab.y b/libpoke/pkl-tab.y
index 50a047b9..a9d933bc 100644
--- a/libpoke/pkl-tab.y
+++ b/libpoke/pkl-tab.y
@@ -403,6 +403,8 @@ token <integer> UNION _("keyword `union'")
%token SIZEOF _("keyword `sizeof'")
%token TYPEOF _("keyword `typeof'")
%token ASSERT _("keyword `assert'")
+%token APUSH _("keyword `apush'")
+%token APOP _("keyword `apop'")
%token ERR _("token")
%token ALIEN
%token INTCONSTR _("int type constructor")
@@ -1243,6 +1245,18 @@ primary:
$$ = pkl_ast_make_unary_exp (pkl_parser->ast,
PKL_AST_OP_SIZEOF, $3);
PKL_AST_LOC ($$) = @1;
}
+ | APUSH '(' expression ',' expression ')'
+ {
+ $$ = pkl_ast_make_binary_exp (pkl_parser->ast,
PKL_AST_OP_APUSH,
+ $3, $5);
+ PKL_AST_LOC ($$) = @1;
+ }
+ | APOP '(' expression ')'
+ {
+ $$ = pkl_ast_make_unary_exp (pkl_parser->ast,
PKL_AST_OP_APOP,
+ $3);
+ PKL_AST_LOC ($$) = @1;
+ }
;
funcall:
diff --git a/libpoke/pkl-typify.c b/libpoke/pkl-typify.c
index 726a1e6b..47667895 100644
--- a/libpoke/pkl-typify.c
+++ b/libpoke/pkl-typify.c
@@ -2942,6 +2942,84 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_ass_stmt)
}
PKL_PHASE_END_HANDLER
+/* The type of an APUSH operation is the type of the array argument.
+
+ The type of the second argument must be the promoteable to the type
+ of the array's elements. */
+
+PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_apush)
+{
+ pkl_ast_node exp = PKL_PASS_NODE;
+ pkl_ast_node op1 = PKL_AST_EXP_OPERAND (PKL_PASS_NODE, 0);
+ pkl_ast_node op2 = PKL_AST_EXP_OPERAND (PKL_PASS_NODE, 1);
+ pkl_ast_node op1_type = PKL_AST_TYPE (op1);
+ pkl_ast_node op2_type = PKL_AST_TYPE (op2);
+ pkl_ast_node op1_elem_type;
+
+ if (PKL_AST_TYPE_CODE (op1_type) != PKL_TYPE_ARRAY)
+ {
+ char *op1_type_str = pkl_type_str (op1_type, 1);
+
+ PKL_ERROR (PKL_AST_LOC (op1),
+ "invalid operand in expression\n"
+ "expected array, got %s",
+ op1_type_str);
+ free (op1_type_str);
+ PKL_TYPIFY_PAYLOAD->errors++;
+ PKL_PASS_ERROR;
+ }
+
+ op1_elem_type = PKL_AST_TYPE_A_ETYPE (op1_type);
+ if (!pkl_ast_type_promoteable_p (op2_type, op1_elem_type,
+ 0 /* promote_array_of_any */))
+ {
+ char *op1_elem_type_str = pkl_type_str (op1_elem_type, 1);
+ char *op2_type_str = pkl_type_str (op2_type, 1);
+
+ PKL_ERROR (PKL_AST_LOC (op2), "invalid operand in expression\n"
+ "expected %s, got %s",
+ op1_elem_type_str, op2_type_str);
+ free (op1_elem_type_str);
+ free (op2_type_str);
+
+ PKL_TYPIFY_PAYLOAD->errors++;
+ PKL_PASS_ERROR;
+ }
+
+ PKL_AST_TYPE (exp) = ASTREF (op1_type);
+}
+PKL_PHASE_END_HANDLER
+
+/* The type of an APOP operation is the type of the elements of the
+ array argument.
+
+ The argument of an APOP must be an array. */
+
+PKL_PHASE_BEGIN_HANDLER (pkl_typify1_ps_op_apop)
+{
+ pkl_ast_node exp = PKL_PASS_NODE;
+ pkl_ast_node op = PKL_AST_EXP_OPERAND (PKL_PASS_NODE, 0);
+ pkl_ast_node op_type = PKL_AST_TYPE (op);
+ pkl_ast_node op_elem_type;
+
+ if (PKL_AST_TYPE_CODE (op_type) != PKL_TYPE_ARRAY)
+ {
+ char *op_type_str = pkl_type_str (op_type, 1);
+
+ PKL_ERROR (PKL_AST_LOC (op),
+ "invalid operand in expression\n"
+ "expected array, got %s",
+ op_type_str);
+ free (op_type_str);
+ PKL_TYPIFY_PAYLOAD->errors++;
+ PKL_PASS_ERROR;
+ }
+
+ op_elem_type = PKL_AST_TYPE_A_ETYPE (op_type);
+ PKL_AST_TYPE (exp) = ASTREF (op_elem_type);
+}
+PKL_PHASE_END_HANDLER
+
/* The type of an EXCOND ?! operation is a boolean encoded in an
int<32>.
@@ -3045,6 +3123,8 @@ struct pkl_phase pkl_phase_typify1 =
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_BCONC, pkl_typify1_ps_op_bconc),
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_IN, pkl_typify1_ps_op_in),
PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_EXCOND, pkl_typify1_ps_op_excond),
+ PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_APUSH, pkl_typify1_ps_op_apush),
+ PKL_PHASE_PS_OP_HANDLER (PKL_AST_OP_APOP, pkl_typify1_ps_op_apop),
PKL_PHASE_PS_TYPE_HANDLER (PKL_TYPE_INTEGRAL, pkl_typify1_ps_type_integral),
PKL_PHASE_PS_TYPE_HANDLER (PKL_TYPE_ARRAY, pkl_typify1_ps_type_array),
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index cb770d1e..fd8994c5 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -668,6 +668,14 @@ EXTRA_DIST = \
poke.pkl/and-int-struct-1.pk \
poke.pkl/and-int-struct-2.pk \
poke.pkl/and-int-struct-3.pk \
+ poke.pkl/apop-1.pk \
+ poke.pkl/apop-2.pk \
+ poke.pkl/apop-diag-1.pk \
+ poke.pkl/apush-1.pk \
+ poke.pkl/apush-2.pk \
+ poke.pkl/apush-diag-1.pk \
+ poke.pkl/apush-diag-2.pk \
+ poke.pkl/apush-diag-3.pk \
poke.pkl/array-1.pk \
poke.pkl/array-2.pk \
poke.pkl/array-bound-diag-1.pk \
diff --git a/testsuite/poke.pkl/apop-1.pk b/testsuite/poke.pkl/apop-1.pk
new file mode 100644
index 00000000..041e57ab
--- /dev/null
+++ b/testsuite/poke.pkl/apop-1.pk
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+
+/* { dg-command {apop ([1,2,3])} } */
+/* { dg-output "\\\[1,2\\\]" } */
diff --git a/testsuite/poke.pkl/apop-2.pk b/testsuite/poke.pkl/apop-2.pk
new file mode 100644
index 00000000..3db37e72
--- /dev/null
+++ b/testsuite/poke.pkl/apop-2.pk
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+
+/* { dg-command {try apop (int[]()); catch if E_out_of_bounds { print
"caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/apop-diag-1.pk
b/testsuite/poke.pkl/apop-diag-1.pk
new file mode 100644
index 00000000..3d138ad3
--- /dev/null
+++ b/testsuite/poke.pkl/apop-diag-1.pk
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+
+var a =
+ apop (Exception {} /* { dg-error "invalid operand.*\n.*expected array" } */
+ );
diff --git a/testsuite/poke.pkl/apush-1.pk b/testsuite/poke.pkl/apush-1.pk
new file mode 100644
index 00000000..66723ab6
--- /dev/null
+++ b/testsuite/poke.pkl/apush-1.pk
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+
+/* { dg-command {apush (apush ([1,2,3], 4), 5)} } */
+/* { dg-output "\\\[1,2,3,4,5\\\]" } */
diff --git a/testsuite/poke.pkl/apush-2.pk b/testsuite/poke.pkl/apush-2.pk
new file mode 100644
index 00000000..51268c3a
--- /dev/null
+++ b/testsuite/poke.pkl/apush-2.pk
@@ -0,0 +1,4 @@
+/* { dg-do run } */
+
+/* { dg-command {apush (apush ([[1],[2],[3]], [4]), [5])} } */
+/* { dg-output "\\\[\\\[1\\\],\\\[2\\\],\\\[3\\\],\\\[4\\\],\\\[5\\\]\\\]" } */
diff --git a/testsuite/poke.pkl/apush-diag-1.pk
b/testsuite/poke.pkl/apush-diag-1.pk
new file mode 100644
index 00000000..991c950b
--- /dev/null
+++ b/testsuite/poke.pkl/apush-diag-1.pk
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+
+var a =
+ apush ("foo", /* { dg-error "invalid operand.*\n.*expected array" } */
+ 10);
diff --git a/testsuite/poke.pkl/apush-diag-2.pk
b/testsuite/poke.pkl/apush-diag-2.pk
new file mode 100644
index 00000000..c6fe5af5
--- /dev/null
+++ b/testsuite/poke.pkl/apush-diag-2.pk
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+
+var a =
+ apush ([1,2,3],
+ "foo"); /* { dg-error "invalid operand.*\n.*expected int" } */
diff --git a/testsuite/poke.pkl/apush-diag-3.pk
b/testsuite/poke.pkl/apush-diag-3.pk
new file mode 100644
index 00000000..128575b4
--- /dev/null
+++ b/testsuite/poke.pkl/apush-diag-3.pk
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+
+var a =
+ apush ([[""],[""],[""]],
+ [1]); /* { dg-error "invalid operand.*\n.*expected string" } */
--
2.11.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [COMMITTED] pkl: support for the APUSH and APOP operators,
Jose E. Marchesi <=