Skip to content

Commit ae80223

Browse files
committed
Eliminate merge conflicts.
1 parent fa598b6 commit ae80223

File tree

3 files changed

+23
-39
lines changed

3 files changed

+23
-39
lines changed

typed-racket-lib/typed-racket/base-env/base-env.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@
10551055
[(-Mutable-HashTableTop) -Mutable-HashTableTop]
10561056
[((-Weak-HT a b)) (-Weak-HT a b)]
10571057
[(-Weak-HashTableTop) -Weak-HashTableTop]
1058-
[((-HT a b)) (-HT a b)]))]
1058+
[((-HT a b)) (Un (-Mutable-HT a b) (-Weak-HT a b))]))]
10591059
[eq-hash-code (-> Univ -Fixnum)]
10601060
[eqv-hash-code (-> Univ -Fixnum)]
10611061
[equal-hash-code (-> Univ -Fixnum)]

typed-racket-lib/typed-racket/base-env/prims.rkt

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -579,48 +579,32 @@ the typed racket language.
579579
(for/set: for/fold: for/set #f set-add (set) #%expression)
580580
(for*/set: for*/fold: for*/set #t set-add (set) #%expression)))
581581

582-
(define-for-syntax (define-for/hash:-variant hash-maker)
583-
(lambda (stx)
584-
(syntax-parse stx
585-
[(_ a1:optional-standalone-annotation*
586-
clause:for-clauses
587-
a2:optional-standalone-annotation*
588-
body ...) ; body is not always an expression, can be a break-clause
589-
(define a.ty (or (attribute a2.ty) (attribute a1.ty)))
590-
(if a.ty
591-
(quasisyntax/loc stx
592-
(for/fold: : #,a.ty
593-
((return-hash : #,a.ty (ann (#,hash-maker null) #,a.ty)))
594-
(clause.expand ... ...)
595-
(let-values (((key val) (let () body ...)))
596-
(hash-set return-hash key val))))
597-
(syntax/loc stx
598-
(for/hash (clause.expand ... ...)
599-
body ...)))])))
582+
(begin-for-syntax
583+
(define-values (define-for/hash:-variant define-for*/hash:-variant)
584+
(let ()
585+
(define ((make for*? for/folder:) hash-maker)
586+
(lambda (stx)
587+
(syntax-parse stx
588+
[(_ a1:optional-standalone-annotation*
589+
clause:for-clauses
590+
a2:optional-standalone-annotation*
591+
body ...) ; body is not always an expression, can be a break-clause
592+
(define a.ty (or (attribute a2.ty) (attribute a1.ty) #'(Immutable-HashTable Any Any)))
593+
(quasisyntax/loc stx
594+
(#,for/folder: : #,a.ty
595+
((return-hash : #,a.ty (ann (#,hash-maker null) #,a.ty)))
596+
#,(if for*?
597+
#'(clause.expand* ... ...)
598+
#'(clause.expand ... ...))
599+
(let-values (((key val) (let () body ...)))
600+
(hash-set return-hash key val))))])))
601+
(values (make #f #'for/fold:) (make #t #'for*/fold:)))))
600602

601603
(define-syntax for/hash: (define-for/hash:-variant #'make-immutable-hash))
602604
(define-syntax for/hasheq: (define-for/hash:-variant #'make-immutable-hasheq))
603605
(define-syntax for/hasheqv: (define-for/hash:-variant #'make-immutable-hasheqv))
604606
(define-syntax for/hashalw: (define-for/hash:-variant #'make-immutable-hashalw))
605607

606-
(define-for-syntax (define-for*/hash:-variant hash-maker)
607-
(lambda (stx)
608-
(syntax-parse stx
609-
#:literals (:)
610-
[(_ a1:optional-standalone-annotation*
611-
clause:for-clauses
612-
a2:optional-standalone-annotation*
613-
body ...) ; body is not always an expression, can be a break-clause
614-
(define a.ty (or (attribute a2.ty) (attribute a1.ty)))
615-
(quasisyntax/loc stx
616-
(for*/fold: #,@(if a.ty #`(: #,a.ty) #'())
617-
#,(if a.ty
618-
#`((return-hash : #,a.ty (ann (#,hash-maker null) #,a.ty)))
619-
#`((return-hash (#,hash-maker null))))
620-
(clause.expand* ... ...)
621-
(let-values (((key val) (let () body ...)))
622-
(hash-set return-hash key val))))])))
623-
624608
(define-syntax for*/hash: (define-for*/hash:-variant #'make-immutable-hash))
625609
(define-syntax for*/hasheq: (define-for*/hash:-variant #'make-immutable-hasheq))
626610
(define-syntax for*/hasheqv: (define-for*/hash:-variant #'make-immutable-hasheqv))

typed-racket-test/unit-tests/typecheck-tests.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,8 +2646,8 @@
26462646
[tc-e (assoc 3 '((a . 5) (b . 7))) (t:Un (-val #f) (-pair (one-of/c 'a 'b) -PosByte))]
26472647
[tc-e (set-remove (set 1 2 3) 'a) (-set -PosByte)]
26482648
;; don't return HashTableTop
2649-
[tc-e (hash-remove #hash((a . 5) (b . 7)) 3) (-Immutable-HT -Symbol -Integer)]
2650-
[tc-e (hash-remove #hash((a . 5) (b . 7)) 3) (-Immutable-HT -Symbol -Integer)]
2649+
[tc-e (hash-remove #hash((a . 5) (b . 7)) 'a) (-Immutable-HT -Symbol -Integer)]
2650+
[tc-e (hash-remove #hash((a . 5) (b . 7)) 3) (-Immutable-HT -Symbol -Integer)]
26512651
;; these should actually work
26522652
[tc-e (vector-memq 3 #(a b c)) (t:Un (-val #f) -Index)]
26532653
[tc-e (vector-memv 3 #(a b c)) (t:Un (-val #f) -Index)]

0 commit comments

Comments
 (0)