diff --git a/collects/tests/typed-scheme/fail/ht-infer.ss b/collects/tests/typed-scheme/fail/ht-infer.ss new file mode 100644 index 00000000..19c97d8d --- /dev/null +++ b/collects/tests/typed-scheme/fail/ht-infer.ss @@ -0,0 +1,29 @@ +#lang scheme/load + +(module before typed/scheme + + (provide (all-defined-out)) + + (define-struct: Sigil ()) + + (: list->english ((Listof String) -> String)) + (define (list->english strs) (error 'fail)) + + (define-type-alias (Set X) (HashTable X '())) + + (: empty-set (All (T) (-> (Set T)))) + (define (empty-set) (error 'fail)) + + (: set->list (All (T) ((Set T) -> (Listof T)))) + (define (set->list set) (error 'fail)) + ) + +(module after typed/scheme + (require 'before) + + (: f ((Set Sigil) -> Any)) + (define (f x1) + (let* ([x2 (set->list x1)]) + (list->english x2) + (error 'NO! "Way!")))) + diff --git a/collects/typed-scheme/infer/infer-unit.ss b/collects/typed-scheme/infer/infer-unit.ss index fdc6da25..b1609af1 100644 --- a/collects/typed-scheme/infer/infer-unit.ss +++ b/collects/typed-scheme/infer/infer-unit.ss @@ -387,7 +387,7 @@ [((Box: e) (Box: e*)) (cset-meet (cg e e*) (cg e* e))] [((Hashtable: s1 s2) (Hashtable: t1 t2)) - ;; the key is contravariant, the value is invariant + ;; for mutable hash tables, both are invariant (cset-meet* (list (cg t1 s1) (cg s1 t1) (cg t2 s2) (cg s2 t2)))] [((Syntax: s1) (Syntax: s2)) (cg s1 s2)]