Changeset 37809 in project


Ignore:
Timestamp:
07/31/19 16:54:38 (3 weeks ago)
Author:
megane
Message:

[typed-records]: Use module prefix in constructor specializations

Location:
release/5/typed-records/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/5/typed-records/trunk/tests/t.scm

    r37355 r37809  
    9393 (defstruct ds-m*
    9494   ((b 1) : number)))
     95
     96(begin ;; Reported by alicemaz
     97  (module
     98   m2
     99   (make-r r-def-lam?)
     100   (import scheme (chicken base) typed-records)
     101   (define-record r)
     102   (define (r-def-lam? x) (r? x)))
     103
     104  (import m2)
     105  (test "constructor's specialization uses module prefix for tag" #t (r-def-lam? (make-r))))
  • release/5/typed-records/trunk/typed-records.scm

    r37355 r37809  
    1616
    1717 (import-for-syntax (srfi 1) (chicken base))
    18 
    19 
     18 (import (only chicken.syntax define-for-syntax))
     19
     20 (define-for-syntax (get-tag plain-name)
     21   ;; copy&paste from chicken-syntax.scm
     22   (if (##sys#current-module)
     23       (symbol-append
     24        (##sys#module-name (##sys#current-module)) '|#| plain-name)
     25       plain-name))
     26 
    2027(define-syntax define-record
    2128  (er-macro-transformer
     
    5259                  (,(map cdr names/types)
    5360                   (##sys#make-structure
    54                     ',name
     61                    ',(get-tag name)
    5562                    ,@(list-tabulate
    5663                       (length names/types)
     
    139146                         (cdr ctor))
    140147                   (##sys#make-structure
    141                     ',name
     148                    ',(get-tag name)
    142149                    ,@(let lp [(names (map first accs/mods/types))
    143150                               (l '())]
Note: See TracChangeset for help on using the changeset viewer.