File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
typed-racket-lib/typed-racket/types Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 2222 "utils/tc-utils.rkt "
2323 "types/struct-table.rkt "
2424 "infer/infer.rkt "
25+ "env/type-name-env.rkt "
2526 "types/substitute.rkt " )
2627 (for-syntax racket/base syntax/parse))
2728
573574;; type->sexp : Type -> S-expression
574575;; convert a type to an s-expression that can be printed
575576(define (type->sexp type [ignored-names '() ])
576- (define (t->s type)
577+ (define (t->s type [ignored-names '() ] )
577578 (parameterize ([current-print-type-fuel
578579 (sub1 (current-print-type-fuel))])
579- (type->sexp type)))
580+ (type->sexp type ignored-names )))
580581 (define (tuple? t)
581582 (match t
582583 [(Pair: a (? tuple?)) #t ]
600601 [(Univ:) 'Any ]
601602 [(Bottom:) 'Nothing ]
602603 ;; struct names are just printed as the original syntax
603- [(Name/struct: id) (syntax-e id)]
604+ [(Name/struct: id)
605+ (match (lookup-type-name id (lambda () #f ))
606+ [(and (? Prefab?) ty) (t->s ty (cons id ignored-names))]
607+ [_ (syntax-e id)])]
604608 ;; If a type has a name, then print it with that name.
605609 ;; However, we expand the alias in some cases
606610 ;; (i.e., the fuel is > 0) for the :type form.
607611 [(app has-name? (? values names))
608612 (=> fail)
609- (when (not ( null? ignored-names) ) (fail))
613+ (unless ( null? ignored-names) (fail))
610614 (define fuel (current-print-type-fuel))
611615 (cond [(> fuel 0 )
612616 (parameterize ([current-print-type-fuel (sub1 fuel)])
Original file line number Diff line number Diff line change 1+ #;
2+ (exn-pred #rx"expected: \\(Prefab container String\\).*given: \\(Prefab container Positive-Byte\\) " )
3+ #lang typed/racket/base
4+
5+ (define val '#s(container 10 ))
6+ (struct container
7+ ([value : String])
8+ #:prefab )
9+ (ann val container)
10+
You can’t perform that action at this time.
0 commit comments