about summary refs log tree commit diff stats
path: root/edit
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-12-14 01:30:56 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-12-15 10:20:41 -0800
commit601ff75bc76b5cdc76d54a399dd764cf399822e3 (patch)
treec92fd13ea83e0d666f1986f52ffc032b3955ec91 /edit
parente167fdf43cedea8b96690246734d652643fe1bd1 (diff)
downloadmu-601ff75bc76b5cdc76d54a399dd764cf399822e3.tar.gz
three bugs fixed
- notes
bug in edit/ triggers in immutable but not master branch
bug triggered by changes to layer 059: we're finding an unspecialized call to 'length' in 'append_6'

hard to debug because trace isn't complete
just bring out the big hammer: use a new log file

length_2 from recipes.mu is not being deleted (bug #1)
so reload doesn't switch length to length_2 when variant_already_exists (bug #2)
so we end up saving in Recipe for a primitive ordinal
so no valid specialization is found for 'length' (bug #3)

why doesn't it trigger in a non-interactive scenario?
argh, wasn't checking for an empty line at end. ok, confidence restored.
Diffstat (limited to 'edit')
-rw-r--r--edit/005-sandbox.mu3
-rw-r--r--edit/010-warnings.mu62
2 files changed, 65 insertions, 0 deletions
diff --git a/edit/005-sandbox.mu b/edit/005-sandbox.mu
index 1c024b2b..a8a4c5a3 100644
--- a/edit/005-sandbox.mu
+++ b/edit/005-sandbox.mu
@@ -114,6 +114,7 @@ after <global-keypress> [
   {
     do-run?:boolean <- equal *k, 65532/F4
     break-unless do-run?
+#?     $log [F4 pressed]
     status:address:array:character <- new [running...  ]
     screen <- update-status screen, status, 245/grey
     error?:boolean, env, screen <- run-sandboxes env, screen
@@ -226,6 +227,7 @@ recipe save-sandboxes env:address:programming-environment-data [
 recipe! render-sandbox-side screen:address:screen, env:address:programming-environment-data -> screen:address:screen [
   local-scope
   load-ingredients
+#?   $log [render sandbox side]
   trace 11, [app], [render sandbox side]
   current-sandbox:address:editor-data <- get *env, current-sandbox:offset
   left:number <- get *current-sandbox, left:offset
@@ -242,6 +244,7 @@ recipe! render-sandbox-side screen:address:screen, env:address:programming-envir
 recipe render-sandboxes screen:address:screen, sandbox:address:sandbox-data, left:number, right:number, row:number -> row:number, screen:address:screen, sandbox:address:sandbox-data [
   local-scope
   load-ingredients
+#?   $log [render sandbox]
   reply-unless sandbox
   screen-height:number <- screen-height screen
   at-bottom?:boolean <- greater-or-equal row, screen-height
diff --git a/edit/010-warnings.mu b/edit/010-warnings.mu
index 5e41cf12..419d9c8f 100644
--- a/edit/010-warnings.mu
+++ b/edit/010-warnings.mu
@@ -8,6 +8,7 @@ container programming-environment-data [
 recipe! update-recipes env:address:programming-environment-data, screen:address:screen -> errors-found?:boolean, env:address:programming-environment-data, screen:address:screen [
   local-scope
   load-ingredients
+#?   $log [update recipes]
   recipes:address:editor-data <- get *env, recipes:offset
   in:address:array:character <- editor-contents recipes
   save [recipes.mu], in
@@ -49,6 +50,7 @@ container sandbox-data [
 recipe! update-sandbox sandbox:address:sandbox-data -> sandbox:address:sandbox-data [
   local-scope
   load-ingredients
+#?   $log [update sandbox]
   data:address:array:character <- get *sandbox, data:offset
   response:address:address:array:character <- get-address *sandbox, response:offset
   warnings:address:address:array:character <- get-address *sandbox, warnings:offset
@@ -199,6 +201,66 @@ z <- add x, [a]
   ]
 ]
 
+scenario run-avoids-spurious-warnings-on-reloading-shape-shifting-recipes [
+  trace-until 100/app  # trace too long
+  assume-screen 100/width, 15/height
+  # overload a well-known shape-shifting recipe
+  1:address:array:character <- new [recipe length l:address:list:_elem -> n:number [
+]]
+  # call code that uses other variants of it, but not it itself
+  2:address:array:character <- new [x:address:list:number <- copy 0
+to-text x]
+  3:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character, 2:address:array:character
+  # run it once
+  assume-console [
+    press F4
+  ]
+  event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
+  # no errors anywhere on screen (can't check anything else, since to-text will return an address)
+  screen-should-contain-in-color 1/red, [
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                         <-                         .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+  ]
+  # rerun everything
+  assume-console [
+    press F4
+  ]
+  run [
+    event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data
+  ]
+  # still no errors
+  screen-should-contain-in-color 1/red, [
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                         <-                         .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+    .                                                                                                    .
+  ]
+]
+
 scenario run-shows-missing-type-warnings [
   trace-until 100/app  # trace too long
   assume-screen 100/width, 15/height