liquidsoap icon indicating copy to clipboard operation
liquidsoap copied to clipboard

Typing error on cross handler.

Open smimram opened this issue 2 years ago • 2 comments

This example

#!../../src/liquidsoap -i ../../libs/stdlib.liq ../../libs/deprecations.liq

s = amplify(0.5, sequence([sine(duration=5.), sine(500.)]))
jingle = playlist("files/jingles")

# The subtlety here is that once(jingle) returns a source with methods (such as
# id). The inference thus thinks that a.source has methods. And the function f
# thus cannot be passed to cross because it is not general enough.

def f(a, b)
  sequence([a.source, once(jingle), b.source])
end

s = cross(f, s)

output.dummy(s)

def on_done () =
  test.pass()
  shutdown()
end
thread.run(delay=8., on_done)

exhibits a subtle typing error as indicated in the comment: f takes an a with a method source which is uselessly required to have an id field because of the presence of once and unification. Not really sure about how to get out of this one for now...

smimram avatar Nov 23 '21 15:11 smimram

Minimized version (which does not require standard library):

s = sine()
j = sine()

def once((s:source))
  sine()
end

def f(a)
  ignore([a, once(j)])
end

def cross((f : (source) -> unit), s)
  s
end

s = cross(f, s)

smimram avatar Nov 24 '21 08:11 smimram

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 10 '22 18:07 stale[bot]