Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/src/BackendOnlyStdLib/LibDB.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ let fns : List<BuiltInFn> =
description = "Insert <param val> into <param table>"
fn =
function
| state, [ v; table ] -> removedFunction state "DB::insert"
| state, [ v; table ] ->
removedFunction state "DB::insert"
| _ -> incorrectArgs ()
sqlSpec = NotQueryable
previewable = Impure
Expand Down
1 change: 1 addition & 0 deletions backend/src/LibBackend/Traces.fs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module PTParser = LibExecution.ProgramTypesParser
// -------------------------
// Input variables (including samples)
// -------------------------
// TODO_USE_A_SOURCE_ID (check all usages - try to provide a source in some)
let incomplete = RT.DIncomplete RT.SourceNone

let sampleHttpRequestInputVars : AT.InputVars =
Expand Down
1 change: 1 addition & 0 deletions backend/src/LibExecution/Errors.fs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ let incorrectArgsToDError (source : DvalSource) (fn : Fn) (argList : List<Dval>)
/// When a function has been removed (rarely happens but does happen occasionally)
let removedFunction (state : ExecutionState) (fnName : string) : DvalTask =
state.notify state "function removed" [ "fnName", fnName ]
// TODO_USE_A_SOURCE_ID It seems reasonable this could take the fn reference ID
Ply(DError(SourceNone, $"{fnName} was removed from Dark"))

/// When you have a fakeval, you typically just want to return it.
Expand Down
1 change: 1 addition & 0 deletions backend/src/LibExecution/Interpreter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ and callFn
| _ ->
Map.find dbname state.program.dbs
|> (fun (db : DB.T) -> db.cols)
// TODO_USE_A_SOURCE_ID ?
|> List.map (fun (field, _) -> (field, DIncomplete SourceNone))
|> Map.ofList
|> DObj
Expand Down
9 changes: 6 additions & 3 deletions backend/src/LibExecution/RuntimeTypes.fs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ and MatchPattern =
| MPBlank of id
| MPTuple of id * MatchPattern * MatchPattern * List<MatchPattern>

type DvalMap = Map<string, Dval>
type DvalMap = Map<string, id * Dval>

and LambdaImpl = { parameters : List<id * string>; symtable : Symtable; body : Expr }

Expand Down Expand Up @@ -473,7 +473,7 @@ module Dval =
| DErrorRail dv -> dv
| other -> other

let toPairs (dv : Dval) : Result<List<string * Dval>, string> =
let toPairs (dv : Dval) : Result<List<string * id * Dval>, string> =
match dv with
| DObj obj -> Ok(Map.toList obj)
| _ -> Error "expecting str"
Expand Down Expand Up @@ -618,6 +618,7 @@ module Dval =
| DObj _, _, v when isFake v -> v
// Error if the key appears twice
| DObj m, k, v when Map.containsKey k m ->
// TODO_USE_A_SOURCE_ID ?
DError(SourceNone, $"Duplicate key: {k}")
// Otherwise add it
| DObj m, k, v -> DObj(Map.add k v m)
Expand All @@ -643,6 +644,7 @@ module Dval =
| DObj _, _, (DErrorRail _ as v) -> v
// Error if the key appears twice
| DObj m, k, v when Map.containsKey k m ->
// TODO_USE_A_SOURCE_ID ?
DError(SourceNone, $"Duplicate key: {k}")
// Otherwise add it
| DObj m, k, v -> DObj(Map.add k v m)
Expand Down Expand Up @@ -670,6 +672,7 @@ module Dval =
| Some dv -> optionJust dv // checks isFake
| None -> DOption None

// TODO_USE_A_SOURCE_ID
let errStr (s : string) : Dval = DError(SourceNone, s)

let errSStr (source : DvalSource) (s : string) : Dval = DError(source, s)
Expand Down Expand Up @@ -873,7 +876,7 @@ and Fn =
/// </remarks>
fn : FnImpl }

and BuiltInFnSig = (ExecutionState * List<Dval>) -> DvalTask
and BuiltInFnSig = (ExecutionState * List<id * Dval>) -> DvalTask

and FnImpl =
| StdLib of BuiltInFnSig
Expand Down
4 changes: 3 additions & 1 deletion backend/src/LibExecutionStdLib/LibDate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ let fns : List<BuiltInFn> =
(function
| _, [ DStr s ] ->
match ocamlCompatibleDateParser s with
| Error () -> Ply(DError(SourceNone, "Invalid date format"))
| Error () ->
// TODO_USE_A_SOURCE_ID
Ply(DError(SourceNone, "Invalid date format"))
| Ok d -> Ply(DDate d)
| _ -> incorrectArgs ())
sqlSpec = NotQueryable
Expand Down
1 change: 1 addition & 0 deletions backend/src/LibExecutionStdLib/LibDict.fs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ let fns : List<BuiltInFn> =
}

if incomplete.Value then
// TODO_USE_A_SOURCE_ID
return DIncomplete SourceNone (*TODO(ds) source info *)
else
let! result = Ply.Map.filterSequentially f o
Expand Down
1 change: 1 addition & 0 deletions backend/src/LibExecutionStdLib/LibFloat.fs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ let fns : List<BuiltInFn> =
(function
| _, [ DFloat v; DFloat a; DFloat b ] ->
if System.Double.IsNaN a || System.Double.IsNaN b then
// TODO_USE_A_SOURCE_ID
Ply(DError(SourceNone, "clamp requires arguments to be valid numbers"))
else
let min, max = if a < b then (a, b) else (b, a)
Expand Down
4 changes: 3 additions & 1 deletion backend/src/LibExecutionStdLib/LibJson.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ let fns : List<BuiltInFn> =
| _, [ DStr json ] ->
match DvalReprLegacyExternal.ofUnknownJsonV1 json with
| Ok dv -> Ply dv
| Error msg -> Ply(DError(SourceNone, msg))
| Error msg ->
// TODO_USE_A_SOURCE_ID
Ply(DError(SourceNone, msg))
| _ -> incorrectArgs ())
sqlSpec = NotYetImplementedTODO
previewable = Pure
Expand Down
2 changes: 2 additions & 0 deletions backend/src/LibExecutionStdLib/LibList.fs
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ let fns : List<BuiltInFn> =
}

if incomplete.Value then
// TODO_USE_A_SOURCE_ID
return DIncomplete SourceNone
else
let! result = Ply.List.filterSequentially f l
Expand Down Expand Up @@ -808,6 +809,7 @@ let fns : List<BuiltInFn> =
}

if incomplete then
// TODO_USE_A_SOURCE_ID
return DIncomplete SourceNone
else
let! result = Ply.List.filterSequentially f l
Expand Down