Disallow unit/new-import-export if contracts are involved. This is not
planned to be permanent, but until I've figured out how to implement the fix, just say no. svn: r13311
This commit is contained in:
parent
b86e4473f0
commit
2f323578de
|
@ -762,29 +762,45 @@
|
|||
(define v
|
||||
#`(hash-table-get #,table-stx #,(car (tagged-info->keys tagged-info))))
|
||||
(for-each
|
||||
(lambda (int/ext-name index)
|
||||
(lambda (int/ext-name index ctc)
|
||||
(bound-identifier-mapping-put! def-table
|
||||
(car int/ext-name)
|
||||
#`(vector-ref #,v #,index)))
|
||||
(cons #`(vector-ref #,v #,index) ctc)))
|
||||
(car sig)
|
||||
(iota (length (car sig)))))
|
||||
(iota (length (car sig)))
|
||||
(cadddr sig)))
|
||||
import-tagged-infos
|
||||
import-sigs)
|
||||
(with-syntax ((((eloc ...) ...)
|
||||
(map
|
||||
(lambda (target-sig)
|
||||
(map
|
||||
(lambda (target-int/ext-name)
|
||||
(bound-identifier-mapping-get
|
||||
def-table
|
||||
(car target-int/ext-name)
|
||||
(lambda ()
|
||||
(raise-stx-err
|
||||
(format (if import?
|
||||
"identifier ~a is not present in new imports"
|
||||
"identifier ~a is not present in old export")
|
||||
(syntax-e (car target-int/ext-name)))))))
|
||||
(car target-sig)))
|
||||
(lambda (target-int/ext-name target-ctc)
|
||||
(when target-ctc
|
||||
(raise-stx-err
|
||||
(format (if import?
|
||||
"identifier ~a is contracted in old imports"
|
||||
"identifier ~a is contracted in new exports")
|
||||
(syntax-e (car target-int/ext-name)))))
|
||||
(let ([vref/ctc
|
||||
(bound-identifier-mapping-get
|
||||
def-table
|
||||
(car target-int/ext-name)
|
||||
(lambda ()
|
||||
(raise-stx-err
|
||||
(format (if import?
|
||||
"identifier ~a is not present in new imports"
|
||||
"identifier ~a is not present in old exports")
|
||||
(syntax-e (car target-int/ext-name))))))])
|
||||
(when (cdr vref/ctc)
|
||||
(raise-stx-err
|
||||
(format (if import?
|
||||
"identifier ~a is contracted in new imports"
|
||||
"identifier ~a is contracted in old exports")
|
||||
(syntax-e (car target-int/ext-name)))))
|
||||
(car vref/ctc)))
|
||||
(car target-sig)
|
||||
(cadddr target-sig)))
|
||||
target-import-sigs))
|
||||
(((export-keys ...) ...)
|
||||
(map tagged-info->keys target-import-tagged-infos)))
|
||||
|
|
|
@ -195,3 +195,47 @@
|
|||
(f 3))
|
||||
(test-runtime-error exn:fail:contract? "top-level misuses f"
|
||||
(f #t)))
|
||||
|
||||
;; eventually we can hopefully fix this so these are allowed, but for right
|
||||
;; now, test that they fail during unit/new-import-export
|
||||
|
||||
(define-signature sig7 (x))
|
||||
(define-signature sig8 ((contracted [x number?])))
|
||||
|
||||
(define-unit unit12
|
||||
(import sig7)
|
||||
(export)
|
||||
x)
|
||||
(define-unit unit13
|
||||
(import sig8)
|
||||
(export)
|
||||
x)
|
||||
(define-unit unit14
|
||||
(import)
|
||||
(export sig8)
|
||||
(define x 3))
|
||||
(define-unit unit15
|
||||
(import)
|
||||
(export sig7)
|
||||
(define x 3))
|
||||
|
||||
(test-syntax-error "not contracted in old import -> contracted in new"
|
||||
(unit/new-import-export
|
||||
(import sig8)
|
||||
(export)
|
||||
(() unit12 sig7)))
|
||||
(test-syntax-error "contracted in old import -> not contracted in new"
|
||||
(unit/new-import-export
|
||||
(import sig7)
|
||||
(export)
|
||||
(() unit13 sig8)))
|
||||
(test-syntax-error "not contracted in old export -> contracted in new"
|
||||
(unit/new-import-export
|
||||
(import)
|
||||
(export sig8)
|
||||
((sig7) unit14)))
|
||||
(test-syntax-error "contracted in old export -> not contracted in new"
|
||||
(unit/new-import-export
|
||||
(import)
|
||||
(export sig7)
|
||||
((sig8) unit15)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user