poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITTED] pkl: add wrappers to the Pk_Type closures


From: Jose E. Marchesi
Subject: [COMMITTED] pkl: add wrappers to the Pk_Type closures
Date: Sun, 23 Jan 2022 20:00:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

2022-01-23  Jose E. Marchesi  <jemarch@gnu.org>

        * libpoke/pkl-gen.pks (typifier_writer_wrapper): New function.
        (typifier_any_any_wrapper): Likewise.
        (typifier_any_any_int_wrapper): Likewise.
        (array_typifier): Use the wrappers.
        (struct_typifier): Likewise.
        * libpoke/pkl-gen.c (pkl_gen_pr_decl): Generate struct typifier
        after the other closures have been compiled.
        * testsuite/poke.pkl/typeof-11.pk: New test.
        * testsuite/poke.pkl/typeof-12.pk: Likewise.
        * testsuite/poke.pkl/typeof-13.pk: Likewise.
        * testsuite/poke.pkl/typeof-14.pk: Likewise.
        * testsuite/poke.pkl/typeof-15.pk: Likewise.
        * testsuite/poke.pkl/typeof-16.pk: Likewise.
        * testsuite/poke.pkl/typeof-17.pk: Likewise.
        * testsuite/poke.pkl/typeof-18.pk: Likewise.
        * testsuite/poke.pkl/typeof-19.pk: Likewise.
        * testsuite/poke.pkl/typeof-20.pk: Likewise.
        * testsuite/poke.pkl/typeof-21.pk: Likewise.
        * testsuite/poke.pkl/typeof-22.pk: Likewise.
        * testsuite/Makefile.am (EXTRA_DIST): Add new tests.
---
 ChangeLog                       |  23 +++++
 NEWS                            |   6 +-
 libpoke/pkl-gen.c               |  34 ++++---
 libpoke/pkl-gen.pks             | 220 +++++++++++++++++++++++++++++++++++-----
 libpoke/pkl-rt.pk               |   4 +-
 testsuite/Makefile.am           |  12 +++
 testsuite/poke.pkl/typeof-11.pk |   6 ++
 testsuite/poke.pkl/typeof-12.pk |   6 ++
 testsuite/poke.pkl/typeof-13.pk |   6 ++
 testsuite/poke.pkl/typeof-14.pk |   6 ++
 testsuite/poke.pkl/typeof-15.pk |   6 ++
 testsuite/poke.pkl/typeof-16.pk |   6 ++
 testsuite/poke.pkl/typeof-17.pk |   6 ++
 testsuite/poke.pkl/typeof-18.pk |   6 ++
 testsuite/poke.pkl/typeof-19.pk |   6 ++
 testsuite/poke.pkl/typeof-20.pk |   6 ++
 testsuite/poke.pkl/typeof-21.pk |   6 ++
 testsuite/poke.pkl/typeof-22.pk |   6 ++
 18 files changed, 322 insertions(+), 49 deletions(-)
 create mode 100644 testsuite/poke.pkl/typeof-11.pk
 create mode 100644 testsuite/poke.pkl/typeof-12.pk
 create mode 100644 testsuite/poke.pkl/typeof-13.pk
 create mode 100644 testsuite/poke.pkl/typeof-14.pk
 create mode 100644 testsuite/poke.pkl/typeof-15.pk
 create mode 100644 testsuite/poke.pkl/typeof-16.pk
 create mode 100644 testsuite/poke.pkl/typeof-17.pk
 create mode 100644 testsuite/poke.pkl/typeof-18.pk
 create mode 100644 testsuite/poke.pkl/typeof-19.pk
 create mode 100644 testsuite/poke.pkl/typeof-20.pk
 create mode 100644 testsuite/poke.pkl/typeof-21.pk
 create mode 100644 testsuite/poke.pkl/typeof-22.pk

diff --git a/ChangeLog b/ChangeLog
index 92ede409..587672cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
 2022-01-23  Jose E. Marchesi  <jemarch@gnu.org>
 
+       * libpoke/pkl-gen.pks (typifier_writer_wrapper): New function.
+       (typifier_any_any_wrapper): Likewise.
+       (typifier_any_any_int_wrapper): Likewise.
+       (array_typifier): Use the wrappers.
+       (struct_typifier): Likewise.
+       * libpoke/pkl-gen.c (pkl_gen_pr_decl): Generate struct typifier
+       after the other closures have been compiled.
+       * testsuite/poke.pkl/typeof-11.pk: New test.
+       * testsuite/poke.pkl/typeof-12.pk: Likewise.
+       * testsuite/poke.pkl/typeof-13.pk: Likewise.
+       * testsuite/poke.pkl/typeof-14.pk: Likewise.
+       * testsuite/poke.pkl/typeof-15.pk: Likewise.
+       * testsuite/poke.pkl/typeof-16.pk: Likewise.
+       * testsuite/poke.pkl/typeof-17.pk: Likewise.
+       * testsuite/poke.pkl/typeof-18.pk: Likewise.
+       * testsuite/poke.pkl/typeof-19.pk: Likewise.
+       * testsuite/poke.pkl/typeof-20.pk: Likewise.
+       * testsuite/poke.pkl/typeof-21.pk: Likewise.
+       * testsuite/poke.pkl/typeof-22.pk: Likewise.
+       * testsuite/Makefile.am (EXTRA_DIST): Add new tests.
+
+2022-01-23  Jose E. Marchesi  <jemarch@gnu.org>
+
        * libpoke/pkl-gen.pks (struct_formater): Avoid a segmentation
        fault when compiling formaters for anonymous fields.
        * testsuite/poke.pkl/format-39.pk: New test.
diff --git a/NEWS b/NEWS
index 7f4020bb..ae81e6f8 100644
--- a/NEWS
+++ b/NEWS
@@ -179,8 +179,8 @@ See the manual for detailed information.
     : Elf_Sym_Info { st_bind=0x1UB, st_type=0x0UB }
 
   - Arrays whose elements are integral (integers, other integral
-    arrays, or integral structs) can now be also "integrated" and
-    "deintegrated" using casts:
+    arrays, or integral structs) can now be also "integrated"
+    using casts:
 
     : (poke) [1UB, 0UB] as int
     : 0x10
@@ -188,8 +188,6 @@ See the manual for detailed information.
     : [1UB,0UB]
     : (poke) [[1UB,2UB],[3UB,4UB]] as int
     : 0x1234
-    : (poke) 0x1234 as uint<8>[2][2]
-    : [[1UB,2UB],[3UB,4UB]]
 
     This nice feature has been contributed by Mohammad Reza-Nabipoor.
 
diff --git a/libpoke/pkl-gen.c b/libpoke/pkl-gen.c
index 7a9e9f21..0d26d1eb 100644
--- a/libpoke/pkl-gen.c
+++ b/libpoke/pkl-gen.c
@@ -272,22 +272,6 @@ PKL_PHASE_BEGIN_HANDLER (pkl_gen_pr_decl)
             pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_PEC);               /* CLS */
             pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_DROP);              /* _ */
 
-            if (PKL_AST_TYPE_S_TYPIFIER (type_struct) == PVM_NULL)
-              {
-                pvm_val typifier_closure;
-
-                PKL_GEN_PUSH_SET_CONTEXT (PKL_GEN_CTX_IN_TYPIFIER);
-                RAS_FUNCTION_STRUCT_TYPIFIER (typifier_closure,
-                                              type_struct);
-                PKL_GEN_POP_CONTEXT;
-                PKL_AST_TYPE_S_TYPIFIER (type_struct) = typifier_closure;
-              }
-
-            pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_PUSH,
-                          PKL_AST_TYPE_S_TYPIFIER (type_struct)); /* CLS */
-            pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_PEC);             /* CLS */
-            pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_DROP);            /* _ */
-
             if (PKL_AST_TYPE_S_FORMATER (type_struct) == PVM_NULL)
               {
                 pvm_val formater_closure;
@@ -355,6 +339,24 @@ PKL_PHASE_BEGIN_HANDLER (pkl_gen_pr_decl)
                 pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_DROP);                /* _ 
*/
               }
 
+            /* Note that the typifier must be processed last, as it
+               uses the closures installed above.  */
+            if (PKL_AST_TYPE_S_TYPIFIER (type_struct) == PVM_NULL)
+              {
+                pvm_val typifier_closure;
+
+                PKL_GEN_PUSH_SET_CONTEXT (PKL_GEN_CTX_IN_TYPIFIER);
+                RAS_FUNCTION_STRUCT_TYPIFIER (typifier_closure,
+                                              type_struct);
+                PKL_GEN_POP_CONTEXT;
+                PKL_AST_TYPE_S_TYPIFIER (type_struct) = typifier_closure;
+              }
+
+            pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_PUSH,
+                          PKL_AST_TYPE_S_TYPIFIER (type_struct)); /* CLS */
+            pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_PEC);             /* CLS */
+            pkl_asm_insn (PKL_GEN_ASM, PKL_INSN_DROP);            /* _ */
+
             PKL_PASS_BREAK;
             break;
           }
diff --git a/libpoke/pkl-gen.pks b/libpoke/pkl-gen.pks
index f784c86c..688bc317 100644
--- a/libpoke/pkl-gen.pks
+++ b/libpoke/pkl-gen.pks
@@ -3373,6 +3373,119 @@
         .e common_typifier @type
         .end
 
+;;; RAS_FUNCTION_TYPIFIER_FORMATER_WRAPPER @type
+;;; ( VAL INT -- STR )
+;;;
+;;; Assemble a function that type-checks VAL to be of some given
+;;; type and then calls its formater.
+;;;
+;;; Macro arguments:
+;;; @type is an AST node with the type of the entity being written,
+;;; which can be either an array or a struct.
+
+        .function typifier_formater_wrapper @type
+        prolog
+        ;; If the first argument is not of the right type, raise an
+        ;; exception.
+        swap
+     .c PKL_GEN_PUSH_SET_CONTEXT (PKL_GEN_CTX_IN_TYPE);
+     .c PKL_PASS_SUBPASS (@type);
+     .c PKL_GEN_POP_CONTEXT;
+        isa
+        nip
+        bnzi .type_ok
+        drop
+        push PVM_E_CONV
+        raise
+.type_ok:
+        drop
+        swap
+        strace 0
+        ;; Call the formater.
+        .let #formater = PKL_AST_TYPE_CODE (@type) == PKL_TYPE_ARRAY \
+                       ? PKL_AST_TYPE_A_FORMATER (@type) \
+                      : PKL_AST_TYPE_S_FORMATER (@type)
+        push #formater
+        call
+        return
+        .end
+
+;;; RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER @type
+;;; ( VAL INT -- STR )
+;;;
+;;; Assemble a function that type-checks VAL to be of some given
+;;; type and then calls a function of type (any)any.
+;;;
+;;; Macro arguments:
+;;; @type is an AST node with the type of the entity being written,
+;;; which can be either an array or a struct.
+
+        .function typifier_any_any_wrapper @type #function
+        prolog
+        ;; If the first argument is not of the right type, raise an
+        ;; exception.
+     .c PKL_GEN_PUSH_SET_CONTEXT (PKL_GEN_CTX_IN_TYPE);
+     .c PKL_PASS_SUBPASS (@type);
+     .c PKL_GEN_POP_CONTEXT;
+        isa
+        nip
+        bnzi .type_ok
+        drop
+        push PVM_E_CONV
+        raise
+.type_ok:
+        drop
+        ;; Call the function and return what it returns.
+        push #function
+        call
+        return
+        .end
+
+;;; RAS_FUNCTION_TYPIFIER_ANY_ANY_INT_WRAPPER @type
+;;; ( VAL VAL -- INT )
+;;;
+;;; Assemble a function that type-checks VAL to be of some given
+;;; type and then calls a function of type (any,any)int<32>.
+;;;
+;;; Macro arguments:
+;;; @type is an AST node with the type of the entity being written,
+;;; which can be either an array or a struct.
+
+        .function typifier_any_any_int_wrapper @type #function
+        prolog
+        ;; If the second argument is not of the right type, raise an
+        ;; exception.
+     .c PKL_GEN_PUSH_SET_CONTEXT (PKL_GEN_CTX_IN_TYPE);
+     .c PKL_PASS_SUBPASS (@type);
+     .c PKL_GEN_POP_CONTEXT;
+        isa
+        nip
+        bnzi .second_type_ok
+        drop
+        push PVM_E_CONV
+        raise
+.second_type_ok:
+        drop
+        ;; Ditto for the first
+        swap
+     .c PKL_GEN_PUSH_SET_CONTEXT (PKL_GEN_CTX_IN_TYPE);
+     .c PKL_PASS_SUBPASS (@type);
+     .c PKL_GEN_POP_CONTEXT;
+        isa
+        nip
+        bnzi .first_type_ok
+        drop
+        push PVM_E_CONV
+        raise
+.first_type_ok:
+        drop
+        swap
+        ;; Call the function and return what it returns.
+        push #function
+        call
+        return
+        .end
+
 ;;; RAS_MACRO_ARRAY_TYPIFIER @type
 ;;; ( SCT - SCT )
 ;;;
@@ -3393,25 +3506,50 @@
         push #mapper
         sset
   .c }
-        .let #writer = PKL_AST_TYPE_A_WRITER (@type)
- .c if (#writer != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_A_WRITER (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val writer_closure;
+        .let #function = PKL_AST_TYPE_A_WRITER (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (writer_closure,
+  .c                                           @type, #function);
+        .let #writer = writer_closure
         push "writer"
         push #writer
+        pec
         sset
   .c }
-        .let #formater = PKL_AST_TYPE_A_FORMATER (@type)
- .c if (#formater != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_A_FORMATER (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val formater_closure;
+  .c    RAS_FUNCTION_TYPIFIER_FORMATER_WRAPPER (formater_closure, @type);
+        .let #formater = formater_closure
         push "formater"
         push #formater
+        pec
         sset
   .c }
-        .let #printer = PKL_AST_TYPE_A_PRINTER (@type)
- .c if (#printer != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_A_PRINTER (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val printer_closure;
+        .let #function = PKL_AST_TYPE_A_PRINTER (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (printer_closure,
+  .c                                           @type, #function);
+        .let #printer = printer_closure
         push "printer"
         push #printer
+        pec
+        sset
+  .c }
+  .c if (PKL_AST_TYPE_A_INTEGRATOR (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val integrator_closure;
+        .let #function = PKL_AST_TYPE_A_INTEGRATOR (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (integrator_closure,
+  .c                                           @type, #function);
+        .let #integrator = integrator_closure
+        push "integrator"
+        push #integrator
+        pec
         sset
   .c }
         .end
@@ -3458,46 +3596,74 @@
         push #mapper
         sset
   .c }
-        .let #writer = PKL_AST_TYPE_S_WRITER (@type)
- .c if (#writer != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_S_WRITER (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val writer_closure;
+        .let #function = PKL_AST_TYPE_S_WRITER (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (writer_closure,
+  .c                                           @type, #function);
+        .let #writer = writer_closure
         push "writer"
         push #writer
+        pec
         sset
   .c }
-        .let #comparator = PKL_AST_TYPE_S_COMPARATOR (@type)
- .c if (#comparator != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_S_COMPARATOR (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val comparator_closure;
+        .let #function = PKL_AST_TYPE_S_COMPARATOR (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_INT_WRAPPER (comparator_closure,
+  .c                                               @type, #function);
+        .let #comparator = comparator_closure
         push "comparator"
         push #comparator
+        pec
         sset
   .c }
-        .let #formater = PKL_AST_TYPE_S_FORMATER (@type)
- .c if (#formater != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_S_FORMATER (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val formater_closure;
+  .c    RAS_FUNCTION_TYPIFIER_FORMATER_WRAPPER (formater_closure, @type);
+        .let #formater = formater_closure
         push "formater"
         push #formater
+        pec
         sset
   .c }
-        .let #printer = PKL_AST_TYPE_S_PRINTER (@type)
- .c if (#printer != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_S_PRINTER (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val printer_closure;
+        .let #function = PKL_AST_TYPE_S_PRINTER (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (printer_closure,
+  .c                                           @type, #function);
+        .let #printer = printer_closure
         push "printer"
         push #printer
+        pec
         sset
   .c }
-        .let #integrator = PKL_AST_TYPE_S_INTEGRATOR (@type)
- .c if (#integrator != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_S_INTEGRATOR (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val integrator_closure;
+        .let #function = PKL_AST_TYPE_S_INTEGRATOR (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (integrator_closure,
+  .c                                           @type, #function);
+        .let #integrator = integrator_closure
         push "integrator"
         push #integrator
+        pec
         sset
   .c }
-        .let #deintegrator = PKL_AST_TYPE_S_DEINTEGRATOR (@type)
- .c if (#deintegrator != PVM_NULL)
- .c {
+  .c if (PKL_AST_TYPE_S_DEINTEGRATOR (@type) != PVM_NULL)
+  .c {
+  .c    pvm_val deintegrator_closure;
+        .let #function = PKL_AST_TYPE_S_DEINTEGRATOR (@type)
+  .c    RAS_FUNCTION_TYPIFIER_ANY_ANY_WRAPPER (deintegrator_closure,
+  .c                                           @type, #function);
+        .let #deintegrator = deintegrator_closure
         push "deintegrator"
         push #deintegrator
+        pec
         sset
   .c }
         ;; Now add field entries.  At the moment these are just the
diff --git a/libpoke/pkl-rt.pk b/libpoke/pkl-rt.pk
index 2cfcdc1f..775608de 100644
--- a/libpoke/pkl-rt.pk
+++ b/libpoke/pkl-rt.pk
@@ -458,11 +458,11 @@ type Pk_Type =
 
     Mapper_Fn mapper             if code in [PK_TYPE_ARRAY, PK_TYPE_STRUCT];
     (any)void writer             if code in [PK_TYPE_ARRAY, PK_TYPE_STRUCT];
-    (any,any)int<32> comparator  if code == PK_TYPE_STRUCT;
     (any,int<32>)string formater if code in [PK_TYPE_ARRAY, PK_TYPE_STRUCT];
     (any)any printer             if code in [PK_TYPE_ARRAY, PK_TYPE_STRUCT];
-    (any)any integrator          if code == PK_TYPE_STRUCT;
+    (any)any integrator          if code in [PK_TYPE_ARRAY, PK_TYPE_STRUCT];
     (any)any deintegrator        if code == PK_TYPE_STRUCT;
+    (any,any)int<32> comparator  if code == PK_TYPE_STRUCT;
   };
 
 /**** Set the default load path ****/
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index adc41932..c828737f 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -2124,6 +2124,18 @@ EXTRA_DIST = \
   poke.pkl/typeof-8.pk \
   poke.pkl/typeof-9.pk \
   poke.pkl/typeof-10.pk \
+  poke.pkl/typeof-11.pk \
+  poke.pkl/typeof-12.pk \
+  poke.pkl/typeof-13.pk \
+  poke.pkl/typeof-14.pk \
+  poke.pkl/typeof-15.pk \
+  poke.pkl/typeof-16.pk \
+  poke.pkl/typeof-17.pk \
+  poke.pkl/typeof-18.pk \
+  poke.pkl/typeof-19.pk \
+  poke.pkl/typeof-20.pk \
+  poke.pkl/typeof-21.pk \
+  poke.pkl/typeof-22.pk \
   poke.pkl/typeof-array-1.pk \
   poke.pkl/typeof-array-2.pk \
   poke.pkl/typeof-int-1.pk \
diff --git a/testsuite/poke.pkl/typeof-11.pk b/testsuite/poke.pkl/typeof-11.pk
new file mode 100644
index 00000000..522b45ff
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-11.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Matrix = int[3];
+
+/* { dg-command { try (typeof (Matrix)).writer ("foo"); catch if E_conv { 
print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-12.pk b/testsuite/poke.pkl/typeof-12.pk
new file mode 100644
index 00000000..0301a9e3
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-12.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct {};
+
+/* { dg-command { try (typeof (Foo)).writer (Exception {}); catch if E_conv { 
print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-13.pk b/testsuite/poke.pkl/typeof-13.pk
new file mode 100644
index 00000000..37f2726b
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-13.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Matrix = int[3];
+
+/* { dg-command { try (typeof (Matrix)).formater ("foo",32); catch if E_conv { 
print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-14.pk b/testsuite/poke.pkl/typeof-14.pk
new file mode 100644
index 00000000..7c6aecda
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-14.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Matrix = int[3];
+
+/* { dg-command { try (typeof (Matrix)).printer ("foo"); catch if E_conv { 
print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-15.pk b/testsuite/poke.pkl/typeof-15.pk
new file mode 100644
index 00000000..1db684fb
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-15.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct {};
+
+/* { dg-command { try (typeof (Foo)).formater ("foo",32); catch if E_conv { 
print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-16.pk b/testsuite/poke.pkl/typeof-16.pk
new file mode 100644
index 00000000..f04f5ebc
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-16.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct {};
+
+/* { dg-command { try (typeof (Foo)).printer ("foo"); catch if E_conv { print 
"caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-17.pk b/testsuite/poke.pkl/typeof-17.pk
new file mode 100644
index 00000000..0f49a851
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-17.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct {};
+
+/* { dg-command { try (typeof (Foo)).comparator (Foo {}, "foo"); catch if 
E_conv { print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-18.pk b/testsuite/poke.pkl/typeof-18.pk
new file mode 100644
index 00000000..fcb94a7c
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-18.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct {};
+
+/* { dg-command { try (typeof (Foo)).comparator ("foo", Foo {}); catch if 
E_conv { print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-19.pk b/testsuite/poke.pkl/typeof-19.pk
new file mode 100644
index 00000000..80b295ed
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-19.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct int { int i; };
+
+/* { dg-command { try (typeof (Foo)).integrator (32); catch if E_conv { print 
"caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-20.pk b/testsuite/poke.pkl/typeof-20.pk
new file mode 100644
index 00000000..bdf8c6ff
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-20.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = struct int { int i; };
+
+/* { dg-command { try (typeof (Foo)).deintegrator (32); catch if E_conv { 
print "caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-21.pk b/testsuite/poke.pkl/typeof-21.pk
new file mode 100644
index 00000000..5368178b
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-21.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = int[][];
+
+/* { dg-command { try (typeof (Foo)).printer ("foo"); catch if E_conv { print 
"caught\n"; } } } */
+/* { dg-output "caught" } */
diff --git a/testsuite/poke.pkl/typeof-22.pk b/testsuite/poke.pkl/typeof-22.pk
new file mode 100644
index 00000000..ac98d47d
--- /dev/null
+++ b/testsuite/poke.pkl/typeof-22.pk
@@ -0,0 +1,6 @@
+/* { dg-do run } */
+
+type Foo = int[][];
+
+/* { dg-command { try (typeof (Foo)).integrator (32); catch if E_conv { print 
"caught\n"; } } } */
+/* { dg-output "caught" } */
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]