Skip to content

Fatal Compiler Error: Missing curly braces {} on expect in trace #1206

@Nun0Santos

Description

@Nun0Santos

What Git revision are you using?

This is a private repository used only for small examples and tests. If necessary, I can make it public and provide the Git revision to help understand this potential bug.

What operating system are you using, and which version?

  • macOS Sequoia version 15.6.1

Describe what the problem is?

Code:

pub type MyDatum {
    num: Int
}

pub type MyRedeemer {
    redeemerNum: Int
}

validator spend_datum {
  spend(
    datum: Option<MyDatum>,
    _redeemer: MyRedeemer,
    _utxo: OutputReference,
    _self: Transaction,
  ) {

    trace @"Return Value ": expect Some(_input_datum) = datum
    True
  }

  else(_) {
    fail
  }
}

I found a strange issue with the Aiken compiler.

I opened VS Code at the project's root folder. Since the aiken.toml file is in a sub-folder and not the root, the Aiken Language Server doesn't initialize—which is expected.

However, in my validator code, I am performing a trace call without wrapping the required expect Some(_input_datum) = datum expression in curly braces ({}). This omission causes a compiler error.

Compiler 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: macos
Architecture: aarch64
Version: v1.1.19+e525483

crates/aiken-lang/src/gen_uplc.rs:312:21

   Reached assignment with no dangling expressions

When updating the trace statement in my Aiken validator to enclose the expect expression within curly braces ({}), the aiken check command now executes successfully without errors as expected.l

 trace @"Return Value ": {
    expect Some(_input_datum) = datum
    }

What should be the expected behavior?

I believe that the compiler should handle the missing curly braces in the trace statement more gracefully by issuing a warning or a standard error, rather than a fatal compiler error as shown above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    🔨 Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions