diff --git a/collects/tests/typed-scheme/succeed/list-struct-sum.ss b/collects/tests/typed-scheme/succeed/list-struct-sum.ss new file mode 100644 index 00000000..08e7d49f --- /dev/null +++ b/collects/tests/typed-scheme/succeed/list-struct-sum.ss @@ -0,0 +1,16 @@ + +#lang typed-scheme +(require scheme/list) + +(define-type-alias (ListOf X) (U Empty (Cons X))) +(define-struct: Empty ()) +(define-struct: (X) Cons ((first : X) (rest : (ListOf X)))) + +(: sum ((ListOf Number) -> Number)) +(define (sum alon) + (cond + [(Empty? alon) 0] + [else (+ (Cons-first alon) + (sum (Cons-rest alon)))])) + +(sum (make-Cons 5 (make-Cons 3 (make-Cons 1 (make-Empty))))) \ No newline at end of file diff --git a/collects/typed-scheme/rep/type-rep.ss b/collects/typed-scheme/rep/type-rep.ss index 579d1cf8..bd0338c5 100644 --- a/collects/typed-scheme/rep/type-rep.ss +++ b/collects/typed-scheme/rep/type-rep.ss @@ -106,7 +106,7 @@ poly? pred-id cert)] - [#:key (gensym)]) + [#:key #f #;(gensym)]) ;; kw : keyword? ;; ty : Type diff --git a/collects/typed-scheme/typecheck/tc-expr-unit.ss b/collects/typed-scheme/typecheck/tc-expr-unit.ss index 133e87c6..8eb69eba 100644 --- a/collects/typed-scheme/typecheck/tc-expr-unit.ss +++ b/collects/typed-scheme/typecheck/tc-expr-unit.ss @@ -114,14 +114,14 @@ ;; check-below : (/\ (Result Type -> Result) ;; (Type Type -> Type)) (define (check-below tr1 expected) - (match (list tr1 expected) - [(list (tc-result: t1 te1 ee1) t2) + (match* (tr1 expected) + [((tc-result: t1 te1 ee1) t2) (unless (subtype t1 t2) (tc-error/expr "Expected ~a, but got ~a" t2 t1)) (ret expected)] - [(list t1 t2) + [(t1 t2) (unless (subtype t1 t2) - (tc-error/expr"Expected ~a, but got ~a" t2 t1)) + (tc-error/expr "Expected ~a, but got ~a" t2 t1)) expected])) (define (tc-expr/check form expected)