about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-06-28 23:17:34 -0700
committerKartik Agaram <vc@akkartik.com>2020-06-28 23:17:34 -0700
commit9483fdc1fb880e05f3e19ec75337e0f5aa6ad3cc (patch)
tree881c524df2a47f31a3453f32521d8760e377983a /apps
parent4ddc2620f7886b902dea8b5d876e2e8d49fb1d9a (diff)
downloadmu-9483fdc1fb880e05f3e19ec75337e0f5aa6ad3cc.tar.gz
6591
Diffstat (limited to 'apps')
-rwxr-xr-xapps/mubin339999 -> 340403 bytes
-rw-r--r--apps/mu.subx33
2 files changed, 32 insertions, 1 deletions
diff --git a/apps/mu b/apps/mu
index ad0329e6..ac49b372 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index ca289922..3a655c08 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -5326,6 +5326,32 @@ test-get-with-wrong-output-type-4:
     5d/pop-to-ebp
     c3/return
 
+test-get-with-wrong-output-type-5:
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # setup
+    (clear-stream _test-input-stream)
+    (clear-stream $_test-input-buffered-file->buffer)
+    (clear-stream _test-output-stream)
+    (clear-stream $_test-output-buffered-file->buffer)
+    #
+    (write _test-input-stream "fn foo {\n")
+    (write _test-input-stream "  var a: t\n")
+    (write _test-input-stream "  var c/ecx: (addr handle int) <- get a, x\n")
+    (write _test-input-stream "}\n")
+    (write _test-input-stream "type t {\n")
+    (write _test-input-stream "  x: (handle int)\n")
+    (write _test-input-stream "}\n")
+    # convert
+    (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0)
+    (flush _test-output-buffered-file)
+    # no errors
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 test-get-with-too-few-inouts:
     # . prologue
     55/push-ebp
@@ -11046,7 +11072,12 @@ $check-mu-get-stmt:check-output-type-match:
     # payload of addr type must match 'type' definition
     (lookup *(edi+8) *(edi+0xc))  # Var-type Var-type => eax
     (lookup *(eax+0xc) *(eax+0x10))  # Tree-right Tree-right => eax
-    (lookup *(eax+4) *(eax+8))  # Tree-left Tree-left => eax
+    # if (payload->right == null) payload = payload->left
+    81 7/subop/compare *(eax+0xc) 0/imm32/null  # Tree-right
+    {
+      75/jump-if-!= break/disp8
+      (lookup *(eax+4) *(eax+8))  # Tree-left Tree-left => eax
+    }
     89/<- %edi 0/r32/eax
     # . var output-name/ecx: (addr array byte)
     (lookup *ecx *(ecx+4))  # Var-name Var-name => eax
href='#n217'>217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407