Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive function items: Typing #2314

Open
ChristianGruen opened this issue Jul 12, 2024 · 1 comment
Open

Recursive function items: Typing #2314

ChristianGruen opened this issue Jul 12, 2024 · 1 comment
Labels

Comments

@ChristianGruen
Copy link
Member

ChristianGruen commented Jul 12, 2024

Caused at runtime by tail-call optimizations:

let $f := fn($p, $self) as xs:integer {
  if((1 to 10000)[$p + 1] <= 5000) then $self($p + 1, $self) else $p
}
return $f(1, $f)

Expected: 5000
Result: [XPTY0004] Cannot convert empty-sequence() to xs:integer: ().

@ChristianGruen
Copy link
Member Author

ChristianGruen commented Jul 12, 2024

Possibly related:

let $a := %basex:inline(0) fn($f) as element() { $f() }
return $a(fn() { <xml/> })

Expected: <xml/>
Returned: [XPTY0004] Cannot convert empty-sequence() to element(): ().

→ This one has been fixed by a recent commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant