aiken-lang / aiken

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

`aiken docs` stops working for conditional modules (toml config) #1044

Closed stanislav-az closed 1 month ago

stanislav-az commented 1 month ago

What Git revision are you using?

Version: v1.1.4+79d0e45

Also checked with v1.1.5.

What operating system are you using, and which version?

Operating System: Ubuntu 22.04.5 LTS Architecture: x86_64

Describe what the problem is?

I have added a small conditional configuration like this:

[config.default]
is_mainnet = true

[config.testnet]
is_mainnet = false

And used it inside one of the modules in lib by importing use config and calling config.is_mainnet.

That change breaks aiken docs command:

 % aiken docs
   Generating documentation for myproject 0.0.0 (.)
    Compiling aiken-lang/stdlib v2.1.0 (./build/packages/aiken-lang-stdlib)
      Writing documentation files to ./docs

   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.1.4+79d0e45

   crates/aiken-project/src/docs/source_links.rs:64:72

       called `Option::unwrap()` on a `None` value

What should be the expected behavior?

aiken docs should create documentation successfully.

KtorZ commented 1 month ago

Ho.

stanislav-az commented 1 month ago

Update: when I added another parameter in my configuration aiken docs started working again :)

[config.default]
is_mainnet = true
my_token_name = "MT"

[config.testnet]
is_mainnet = false
my_token_name = "MyToken"