aiken-lang / aiken

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

aiken/string causes compilation error #953

Closed Fell-x27 closed 1 month ago

Fell-x27 commented 1 month ago

What Git revision are you using?

aiken v1.0.28-alpha+c9a1519

What operating system are you using, and which version?

Describe what the problem is?

Adding use aiken/string causes error;

This is fine:

validator {
  fn my_validator(redeemer: Data, context: Data) -> Bool {
    True
  }
}

But this is not:

use aiken/string

validator {
  fn my_validator(redeemer: Data, context: Data) -> Bool {
    True
  }
}

Error:

        Error aiken::check::type_mismatch (link)

  × While trying to make sense of your code...
  ╰─▶ I struggled to unify the types of two expressions.

     ╭─[/home/fell-x27/git/new_cardano/scripts/networks/preview/smarts/price-guess/build/packages/aiken-lang-stdlib/lib/aiken/cbor.ak:114:1]
 114 │ 
 115 │       let (constr, fields) = un_constr_data(self)
     ·           ────────┬───────
     ·                   ╰── expected type 'Pair<Int, List<Data>>'
 116 │ 
     ╰────
  help: I am inferring the following type:

            Pair<Int, List<Data>>

        but I found an expression with a different type:

            (?, ?)

        Either, add type-annotation to improve my inference, or adjust the expression to have the expected type.

      Summary 1 error, 0 warnings

What should be the expected behavior?

No errors, of course :)

KtorZ commented 1 month ago

Please use stdlib >= 1.9.0 starting from aiken == 1.0.28-alpha. In case of doubts, refer to the compatibility matrix.