diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-12 00:06:40 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-12 00:38:36 -0700 |
commit | ea19d0dc2c11f48ca384fb087b4e44ef400bfaa2 (patch) | |
tree | ba204ece67397481a3104f4c7c1d6a0f3ad271f7 /sandbox/011-errors.mu | |
parent | ec1cd4ae38f283970a401354a1ec17823fa0b7da (diff) | |
download | mu-ea19d0dc2c11f48ca384fb087b4e44ef400bfaa2.tar.gz |
3337 - first use of type abbreviations: text
In the process I've uncover a couple of situations we don't support type abbreviations yet. They're next.
Diffstat (limited to 'sandbox/011-errors.mu')
-rw-r--r-- | sandbox/011-errors.mu | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/sandbox/011-errors.mu b/sandbox/011-errors.mu index e311cb52..108ec0ab 100644 --- a/sandbox/011-errors.mu +++ b/sandbox/011-errors.mu @@ -11,13 +11,13 @@ def! update-recipes env:address:programming-environment-data, screen:address:scr load-ingredients { break-if test-recipes - in:address:array:character <- restore [recipes.mu] - recipe-errors:address:array:character <- reload in + in:text <- restore [recipes.mu] + recipe-errors:text <- reload in *env <- put *env, recipe-errors:offset, recipe-errors } { break-unless test-recipes - recipe-errors:address:array:character <- reload test-recipes + recipe-errors:text <- reload test-recipes } *env <- put *env, recipe-errors:offset, recipe-errors # if recipe editor has errors, stop @@ -32,7 +32,7 @@ def! update-recipes env:address:programming-environment-data, screen:address:scr before <render-components-end> [ trace 11, [app], [render status] - recipe-errors:address:array:character <- get *env, recipe-errors:offset + recipe-errors:text <- get *env, recipe-errors:offset { break-unless recipe-errors update-status screen, [errors found ], 1/red @@ -66,8 +66,8 @@ before <render-components-end> [ error-index:number <- get *env, error-index:offset sandboxes-completed-successfully?:boolean <- equal error-index, -1 break-if sandboxes-completed-successfully? - error-index-text:address:array:character <- to-text error-index - status:address:array:character <- interpolate [errors found (_) ], error-index-text + error-index-text:text <- to-text error-index + status:text <- interpolate [errors found (_) ], error-index-text update-status screen, status, 1/red } ] @@ -80,13 +80,13 @@ def! update-sandbox sandbox:address:sandbox-data, env:address:programming-enviro local-scope load-ingredients { - recipe-errors:address:array:character <- get *env, recipe-errors:offset + recipe-errors:text <- get *env, recipe-errors:offset break-unless recipe-errors *sandbox <- put *sandbox, errors:offset, recipe-errors return } - data:address:array:character <- get *sandbox, data:offset - response:address:array:character, errors:address:array:character, fake-screen:address:screen, trace:address:array:character, completed?:boolean <- run-sandboxed data + data:text <- get *sandbox, data:offset + response:text, errors:text, fake-screen:address:screen, trace:text, completed?:boolean <- run-sandboxed data *sandbox <- put *sandbox, response:offset, response *sandbox <- put *sandbox, errors:offset, errors *sandbox <- put *sandbox, screen:offset, fake-screen @@ -110,12 +110,12 @@ def! update-sandbox sandbox:address:sandbox-data, env:address:programming-enviro # make sure we render any trace after <render-sandbox-trace-done> [ { - sandbox-errors:address:array:character <- get *sandbox, errors:offset + sandbox-errors:text <- get *sandbox, errors:offset break-unless sandbox-errors *sandbox <- put *sandbox, response-starting-row-on-screen:offset, 0 # no response { break-unless env - recipe-errors:address:array:character <- get *env, recipe-errors:offset + recipe-errors:text <- get *env, recipe-errors:offset row, screen <- render-text screen, recipe-errors, left, right, 1/red, row } row, screen <- render-text screen, sandbox-errors, left, right, 1/red, row @@ -127,17 +127,17 @@ after <render-sandbox-trace-done> [ scenario run-shows-errors-in-get [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ get 123:number, foo:offset ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -158,9 +158,9 @@ def foo [ scenario run-updates-status-with-first-erroneous-sandbox [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [] - 2:address:array:character <- new [] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 1:text <- new [] + 2:text <- new [] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ # create invalid sandbox 1 type [get foo, x:offset] @@ -170,7 +170,7 @@ scenario run-updates-status-with-first-erroneous-sandbox [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/empty-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/empty-test-recipes ] # status line shows that error is in first sandbox screen-should-contain [ @@ -181,9 +181,9 @@ scenario run-updates-status-with-first-erroneous-sandbox [ scenario run-updates-status-with-first-erroneous-sandbox-2 [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [] - 2:address:array:character <- new [] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 1:text <- new [] + 2:text <- new [] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ # create invalid sandbox 2 type [get foo, x:offset] @@ -196,7 +196,7 @@ scenario run-updates-status-with-first-erroneous-sandbox-2 [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/empty-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/empty-test-recipes ] # status line shows that error is in second sandbox screen-should-contain [ @@ -207,13 +207,13 @@ scenario run-updates-status-with-first-erroneous-sandbox-2 [ scenario run-hides-errors-from-past-sandboxes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [] - 2:address:array:character <- new [get foo, x:offset] # invalid - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 1:text <- new [] + 2:text <- new [get foo, x:offset] # invalid + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 # generate error ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/empty-test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/empty-test-recipes assume-console [ left-click 3, 10 press ctrl-k @@ -240,18 +240,18 @@ scenario run-updates-errors-for-shape-shifting-recipes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # define a shape-shifting recipe with an error - 1:address:array:character <- new [recipe foo x:_elem -> z:_elem [ + 1:text <- new [recipe foo x:_elem -> z:_elem [ local-scope load-ingredients y:address:number <- copy 0 z <- add x, y ]] - 2:address:array:character <- new [foo 2] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo 2] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes screen-should-contain [ . errors found (0) run (F4) . . . @@ -268,7 +268,7 @@ z <- add x, y press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # error should remain unchanged screen-should-contain [ @@ -288,17 +288,17 @@ scenario run-avoids-spurious-errors-on-reloading-shape-shifting-recipes [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # overload a well-known shape-shifting recipe - 1:address:array:character <- new [recipe length l:address:list:_elem -> n:number [ + 1:text <- 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 + 2:text <- new [x:address:list:number <- copy 0 to-text x] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text # run it once assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes # no errors anywhere on screen (can't check anything else, since to-text will return an address) screen-should-contain-in-color 1/red, [ . . @@ -316,7 +316,7 @@ to-text x] press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # still no errors screen-should-contain-in-color 1/red, [ @@ -335,17 +335,17 @@ to-text x] scenario run-shows-missing-type-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ x <- copy 0 ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -361,17 +361,17 @@ scenario run-shows-unbalanced-bracket-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # recipe is incomplete (unbalanced '[') - 1:address:array:character <- new [ + 1:text <- new [ recipe foo \\[ x <- copy 0 ] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -389,19 +389,19 @@ recipe foo \\[ scenario run-shows-get-on-non-container-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope x:address:point <- new point:type get x:address:point, 1:offset ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -417,20 +417,20 @@ def foo [ scenario run-shows-non-literal-get-argument-errors [ trace-until 100/app # trace too long assume-screen 50/width, 20/height - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope x:number <- copy 0 y:address:point <- new point:type get *y:address:point, x:number ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -447,17 +447,17 @@ scenario run-shows-errors-everytime [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # try to run a file with an error - 1:address:array:character <- new [ + 1:text <- new [ def foo [ local-scope x:number <- copy y:number ]] - 2:address:array:character <- new [foo] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes screen-should-contain [ . errors found run (F4) . . . @@ -471,7 +471,7 @@ def foo [ press F4 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] screen-should-contain [ . errors found run (F4) . @@ -486,8 +486,8 @@ def foo [ scenario run-instruction-and-print-errors [ trace-until 100/app # trace too long assume-screen 50/width, 15/height - 1:address:array:character <- new [get 1:address:point, 1:offset] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [get 1:address:point, 1:offset] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text assume-console [ press F4 ] @@ -522,8 +522,8 @@ scenario run-instruction-and-print-errors-only-once [ trace-until 100/app # trace too long assume-screen 50/width, 10/height # editor contains an illegal instruction - 1:address:array:character <- new [get 1234:number, foo:offset] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 1:text <- new [get 1234:number, foo:offset] + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the code in the editors multiple times assume-console [ press F4 @@ -551,10 +551,10 @@ scenario sandbox-can-handle-infinite-loop [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # editor contains an infinite loop - 1:address:array:character <- new [{ + 1:text <- new [{ loop }] - 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:address:array:character + 2:address:programming-environment-data <- new-programming-environment screen:address:screen, 1:text # run the sandbox assume-console [ press F4 @@ -580,7 +580,7 @@ scenario sandbox-with-errors-shows-trace [ trace-until 100/app # trace too long assume-screen 50/width, 20/height # generate a stash and a error - 1:address:array:character <- new [recipe foo [ + 1:text <- new [recipe foo [ local-scope a:number <- next-ingredient b:number <- next-ingredient @@ -588,13 +588,13 @@ stash [dividing by], b _, c:number <- divide-with-remainder a, b return b ]] - 2:address:array:character <- new [foo 4, 0] - 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:address:array:character + 2:text <- new [foo 4, 0] + 3:address:programming-environment-data <- new-programming-environment screen:address:screen, 2:text # run assume-console [ press F4 ] - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes # screen prints error message screen-should-contain [ . errors found (0) run (F4) . @@ -612,7 +612,7 @@ return b left-click 4, 15 ] run [ - event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:address:array:character/test-recipes + event-loop screen:address:screen, console:address:console, 3:address:programming-environment-data, 1:text/test-recipes ] # screen should expand trace screen-should-contain [ |