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

not implemented: MkCons and MkPairData should be handled by an anon function or using [] or ( a, b, .., z) #964

Closed
Fell-x27 opened this issue Jun 23, 2024 · 1 comment · Fixed by #983

Comments

@Fell-x27
Copy link

I've just replaced list.push with cons_list to check if it is more efficient, and then got the error:

   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.29-alpha+16fb02e
   
   crates/aiken-lang/src/gen_uplc.rs:4517:25
   
       not implemented: MkCons and MkPairData should be handled by an anon function or using [] or ( a, b, .., z).

so...here I am :)

You can reproduce it with this snippet:

use aiken/list
use aiken/builtin

fn buggy(arg: List<Int>) -> List<Int> {
  let result =
    arg
      |> list.foldl([], fn(x, acc) { builtin.cons_list(x, acc) })
  result
}

fn not_buggy(arg: List<Int>) -> List<Int> {
  let result =
    arg
      |> list.foldl([], fn(x, acc) { list.push(acc, x) })
  result
}

test bug() {
  let a =
    [1, 2, 3, 4, 5]
  not_buggy(a) == buggy(a)
}
@MicroProofs
Copy link
Member

The bracket operators are simply the cons_list under the hood. There is a type conversion that is necessary so that's why I blocked the builtin for now.

KtorZ added a commit that referenced this issue Jul 27, 2024
  While this builtin is readily available through the Aiken syntax
  `[head, ..tail]`, there's no reason to not support its builtin form
  even though we may not encourage its usage. For completeness and to
  avoid bad surprises, it is now supported.

  Fixes #964.
@github-project-automation github-project-automation bot moved this from 🪣 Backlog to ✅ In Next Release in Project Tracking Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ In Next Release
Development

Successfully merging a pull request may close this issue.

2 participants