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 overloads break when using short function syntax #99

Open
perimosocordiae opened this issue Dec 15, 2021 · 1 comment
Open
Labels

Comments

@perimosocordiae
Copy link
Collaborator

This looks to be related to the way type verification is performed for short function definitions (where the return type is inferred).

Foo ::= (x: i64) => x
// Foo ::= (x: i64, y: i64) -> i64 { return Foo(x) }
Foo ::= (x: i64, y: i64) => Foo(x)

Error:

[140421545211720 compiler/context.cc:179] Assertion failed
    Expected: inserted == true
         LHS: false
         RHS: true
*** SIGABRT received at time=1639546172 on cpu 2 ***
PC: @     0x7fb6705c2808  (unknown)  pthread_kill
    @          0x1923ef0         64  absl::WriteFailureInfo()
    @          0x1923bd4        224  absl::AbslFailureSignalHandler()
    @     0x7fb67056e520  (unknown)  (unknown)
Aborted (core dumped)

If you uncomment the middle line and comment out the last line, then the overloads resolve as expected and everything works.

@asoffer
Copy link
Owner

asoffer commented Dec 15, 2021

That's right. Currently we break the verification step into two parts (signature then body) but keep them combined for short functions. We actually need three steps (parameters then return then body, combining the last two for short functions).

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

2 participants