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 definition failing to compile with inlining enabled #1293

Open
Izaakwltn opened this issue Oct 8, 2024 · 2 comments · May be fixed by #1295
Open

Recursive definition failing to compile with inlining enabled #1293

Izaakwltn opened this issue Oct 8, 2024 · 2 comments · May be fixed by #1295

Comments

@Izaakwltn
Copy link
Collaborator

I'm working through current benchmarks and ran across one that fails to compile with inlining enabled:

(coalton-toplevel

  (declare fib (Integer -> Integer))
  (define (fib n)
    (when (== n 0)
      (return 0))

    (when (== n 1)
      (return 1))

    (+ (fib (- n 1))
        (fib (- n 2)))))
  error: 
    (during macroexpansion of (COALTON-TOPLEVEL
      (DECLARE FIB ...)
      ...))
    Invalid scc binding group. This should have been detected during typechecking.
@Izaakwltn
Copy link
Collaborator Author

On the other hand, this compiles:

(declare fib-generic (Num :a => :a -> :a))
  (define (fib-generic n)
    (when (== n 0)
      (return 0))

    (when (== n 1)
      (return 1))

    (+ (fib-generic (- n 1)) (fib-generic (- n 2))))

@stylewarning
Copy link
Member

CC @amorphedstar

@amorphedstar amorphedstar linked a pull request Oct 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants