about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
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