Skip to content

Commit

Permalink
Fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cruessler committed Feb 8, 2024
1 parent eaa4ca7 commit cc5e75e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/elm/Vm/Primitive.elm
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ array values =
initializeItems value =
Type.toInt value
|> Result.map (\len -> Array.initialize len (always (Type.List [])))
|> Result.mapError (always <| WrongInput "always" (Type.toDebugString value))
|> Result.mapError (always <| WrongInput "array" (Type.toDebugString value))

initializeWithItemsAndOrigin : Array Type.Value -> Int -> Type.Value
initializeWithItemsAndOrigin items origin =
Expand All @@ -671,7 +671,7 @@ array values =

origin =
Type.toInt second
|> Result.mapError (always <| WrongInput "always" (Type.toDebugString second))
|> Result.mapError (always <| WrongInput "array" (Type.toDebugString second))
in
Result.map2 initializeWithItemsAndOrigin items origin

Expand Down
2 changes: 2 additions & 0 deletions tests/Test/Error.elm
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ functionsWithInvalidArguments =

-- In UCBLogo, passing an array to `butfirst` causes a crash.
, printsError "print butfirst (array 2 10)" "butfirst doesn’t like {[] []} as input"
, printsError "print (array 2 \"a)" "array doesn’t like a as input"
, printsError "print (array \"a \"b)" "array doesn’t like a as input"
, printsError "print first []" "first doesn’t like [] as input"
, printsError "print first butfirst \"a" "first doesn’t like || as input"
, printsError "first butfirst \"a" "first doesn’t like || as input"
Expand Down

0 comments on commit cc5e75e

Please sign in to comment.