start converting mlish tests to typed-lang-builder/mlish-core
This commit is contained in:
parent
9ea6c6b513
commit
fba974d8bb
|
@ -1,4 +1,4 @@
|
|||
#lang s-exp "../../mlish.rkt"
|
||||
#lang s-exp "../../typed-lang-builder/mlish-core.rkt"
|
||||
(require "../rackunit-typechecking.rkt")
|
||||
|
||||
;; pattern matching for built-in lists
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang s-exp "../../mlish.rkt"
|
||||
#lang s-exp "../../typed-lang-builder/mlish-core.rkt"
|
||||
(require "../rackunit-typechecking.rkt")
|
||||
|
||||
;; datatype with no self-reference
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang s-exp "../../mlish.rkt"
|
||||
#lang s-exp "../../typed-lang-builder/mlish-core.rkt"
|
||||
(require "../rackunit-typechecking.rkt")
|
||||
|
||||
;; alternate match that supports nested patterns
|
||||
|
@ -17,14 +17,14 @@
|
|||
(match2 (B (tup 2 3)) with
|
||||
[A x -> x]
|
||||
[C (x,y) -> y]
|
||||
[B x -> x]) #:with-msg "branches have incompatible types: \\(× Int Int\\) and Int")
|
||||
[B x -> x]) #:with-msg "branches have incompatible types: Int and \\(× Int Int\\)")
|
||||
|
||||
(typecheck-fail
|
||||
(match2 (B (tup 2 3)) with
|
||||
[A x -> (tup x x)]
|
||||
[C x -> x]
|
||||
[B x -> x])
|
||||
#:with-msg "branches have incompatible types: \\(× Int \\(× Int Int\\)\\) and \\(× Int Int\\)")
|
||||
#:with-msg "branches have incompatible types: \\(× Int Int\\) and \\(× Int \\(× Int Int\\)\\)")
|
||||
|
||||
(check-type
|
||||
(match2 (B (tup 2 3)) with
|
||||
|
@ -241,7 +241,7 @@
|
|||
(match2 (list (list #t #f)) with
|
||||
[nil -> -1]
|
||||
[(list x y) :: tl -> (+ x y)])
|
||||
#:with-msg "Type error applying function \\+")
|
||||
#:with-msg "expected: Int\n *given: Bool")
|
||||
|
||||
;; comma tup pattern syntax
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang s-exp "../../mlish.rkt"
|
||||
#lang s-exp "../../typed-lang-builder/mlish-core.rkt"
|
||||
(require "../rackunit-typechecking.rkt")
|
||||
|
||||
;; tests of polymorphic recursion
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang s-exp "../../mlish.rkt"
|
||||
#lang s-exp "../../typed-lang-builder/mlish-core.rkt"
|
||||
(require "../rackunit-typechecking.rkt")
|
||||
|
||||
;; function polymorphic in list element
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#lang s-exp "../../mlish.rkt"
|
||||
#lang s-exp "../../typed-lang-builder/mlish-core.rkt"
|
||||
(require "../rackunit-typechecking.rkt")
|
||||
|
||||
(define-type (Option X)
|
||||
|
|
|
@ -756,6 +756,7 @@
|
|||
[(match e with . clauses) ▶
|
||||
[#:fail-unless (not (null? (syntax->list #'clauses))) "no clauses"]
|
||||
[⊢ [[e ≫ e-] ⇒ : τ_e]]
|
||||
[#:when (and (not (×? #'τ_e)) (not (List? #'τ_e)))]
|
||||
[#:with t_expect (get-expected-type stx)] ; propagate inferred type
|
||||
[#:with ([Clause:id x:id ...
|
||||
(~optional (~seq #:when e_guard) #:defaults ([e_guard #'(ext-stlc:#%datum . #t)]))
|
||||
|
|
Loading…
Reference in New Issue
Block a user