aeternity / aesophia

Stand alone compiler for the Sophia smart contract language
https://docs.aeternity.com/aesophia
ISC License
51 stars 19 forks source link

False positive "is defined but never used" warning if record depends on type #490

Closed davidyuk closed 9 months ago

davidyuk commented 10 months ago

I found this behaviour in aesophia_cli, but probably it is related to the whole compiler.

Reproduction.aes

main contract Test =
    type option_int = option(int)
    record option_point = {x: int, y: option_int}

    entrypoint test_option_record(a: option_point) = a
$ ./aesophia_cli --version                                                  
Sophia compiler version 7.4.0
$ ./aesophia_cli ./Reproduction.aes                       
Warning in './Reproduction.aes' at line 2, col 5:
The type `option_int` is defined but never used.
cb_+IZGA6BCUfwhvRBYY1PLAU4DgQk4WRXAe41d+BBRRcRYPGzQ1cC4WbD+RNZEHwA3ADcAGg6CPwEDP/7YGGWQADcBNwIHhwI3ADcBBzcCB4cCNwA3AQcBAQCkLwIRRNZEHxFpbml0EdgYZZBJdGVzdF9vcHRpb25fcmVjb3Jkgi8AhTcuNC4wAOFCQ8c=

The warning is not correct, because option_int is used to define option_point.

This appeared while working on https://github.com/aeternity/aepp-calldata-js/pull/251