|
107 | 107 |
|
108 | 108 |
|
109 | 109 | [((tc-result1: t1 p1 o1) (tc-result1: t2 p2 o2)) |
| 110 | + (define (perform-check!) |
| 111 | + (cond |
| 112 | + [(not (subtype t1 t2 o1)) |
| 113 | + (expected-but-got t2 t1)] |
| 114 | + [(and (not (prop-set-better? p1 p2)) |
| 115 | + (object-better? o1 o2)) |
| 116 | + (type-mismatch p2 p1 "mismatch in proposition")] |
| 117 | + [(and (prop-set-better? p1 p2) |
| 118 | + (not (object-better? o1 o2))) |
| 119 | + (type-mismatch (print-object o2) (print-object o1) "mismatch in object")] |
| 120 | + [(and (not (prop-set-better? p1 p2)) |
| 121 | + (not (object-better? o1 o2))) |
| 122 | + (type-mismatch (format "`~a' and `~a'" p2 (print-object o2)) |
| 123 | + (format "`~a' and `~a'" p1 (print-object o1)) |
| 124 | + "mismatch in proposition and object")]) |
| 125 | + (ret t2 (fix-props p2 p1) (fix-object o2 o1))) |
110 | 126 | (cond |
111 | | - [(not (subtype t1 t2 o1)) |
112 | | - (expected-but-got t2 t1)] |
113 | | - [(and (not (prop-set-better? p1 p2)) |
114 | | - (object-better? o1 o2)) |
115 | | - (type-mismatch p2 p1 "mismatch in proposition")] |
116 | | - [(and (prop-set-better? p1 p2) |
117 | | - (not (object-better? o1 o2))) |
118 | | - (type-mismatch (print-object o2) (print-object o1) "mismatch in object")] |
119 | | - [(and (not (prop-set-better? p1 p2)) |
120 | | - (not (object-better? o1 o2))) |
121 | | - (type-mismatch (format "`~a' and `~a'" p2 (print-object o2)) |
122 | | - (format "`~a' and `~a'" p1 (print-object o1)) |
123 | | - "mismatch in proposition and object")]) |
124 | | - (ret t2 (fix-props p2 p1) (fix-object o2 o1))] |
| 127 | + [(with-refinements?) |
| 128 | + (with-naively-extended-lexical-env |
| 129 | + [#:props (list (-is-type o1 t1) |
| 130 | + (-or (PropSet-thn p1) (PropSet-els p1)))] |
| 131 | + (perform-check!))] |
| 132 | + [else (perform-check!)])] |
125 | 133 |
|
126 | 134 | ;; case where expected is like (Values a ... a) but got something else |
127 | 135 | [((tc-results: _ #f) (tc-results: _ (? RestDots?))) |
|
134 | 142 | (fix-results expected)] |
135 | 143 |
|
136 | 144 | ;; case where both have no '...', or both have '...' |
137 | | - ;; NOTE: we ignore the propsets and objects... not sure |
138 | | - ;; why---maybe there's an assumption that users |
139 | | - ;; can't specify props/objects for multiple values? |
140 | | - ;; seems like we should add some checks to this doesn't |
141 | | - ;; turn into an error in the future that we can't fix w/o |
142 | | - ;; breaking programs that relied on it being broken. |
143 | 145 | [((tc-results: tcrs1 db1) |
144 | 146 | (tc-results: tcrs2 db2)) |
145 | 147 | (cond |
|
0 commit comments