Revert "Echo initial value if given a source"

This reverts commit 16e2983c54758cabfb1ddd102090f20083820d03.
This commit is contained in:
Richard 2023-09-18 19:58:39 -07:00 committed by Aaron
parent 6b465280eb
commit fecce96a9f
2 changed files with 1 additions and 11 deletions

View file

@ -9,10 +9,6 @@ local update = graph.update
export type Source<T> = (() -> T) & ((T) -> T) export type Source<T> = (() -> T) & ((T) -> T)
local function source<T>(initial_value: T): Source<T> local function source<T>(initial_value: T): Source<T>
if type(initial_value) == "function" then
return initial_value
end
local node = create_start_node(initial_value) local node = create_start_node(initial_value)
return function(...): T return function(...): T
@ -32,4 +28,4 @@ local function source<T>(initial_value: T): Source<T>
end end
end end
return source :: (<T>(source: Source<T>) -> Source<T>) & (<T>(initial_value: T) -> Source<T>) & (<T>() -> Source<T>) return source :: (<T>(initial_value: T) -> Source<T>) & (<T>() -> Source<T>)

View file

@ -359,12 +359,6 @@ TEST("source()", wrap_root(function()
CHECK(src() == 2) CHECK(src() == 2)
end end
do CASE "echo if value is a source"
local a = source(1)
local b = source(a)
CHECK(a == b)
end
do CASE "does not update if same value" do CASE "does not update if same value"
local src = source(1) local src = source(1)