aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
396 stars 82 forks source link

Compiler crashes when comparing functions #940

Closed t4ccer closed 2 months ago

t4ccer commented 2 months ago

What Git revision are you using?

Compiled from source at 075668b52ea748cb1cd3bc6723b1add752976f0f

$ aiken --version
aiken v1.0.26-alpha+unknown

What operating system are you using, and which version?

Describe what the problem is?

fn not(x: Bool) -> Bool {
   when x is {
     False -> True
     True -> False
   }
}

fn foo() -> Bool {
   not == not
}

When using foo() anywhere in validator code, the compiler crashes.

   aiken::fatal::error
   Whoops! You found a bug in the Aiken compiler.

   Please report this error at https://github.com/aiken-lang/aiken/issues/new.
   In your bug report please provide the information below and if possible the code
   that produced it.

   Operating System: linux
   Architecture:     x86_64
   Version:          v1.0.26-alpha+unknown

   crates/aiken-lang/src/gen_uplc.rs:4193:77

       called `Result::unwrap()` on an `Err` value: NotAConstant(Lambda <a lot of uplc>)

What should be the expected behavior?

Type checker should not allow for comparing functions