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

Closed
opened 2023-11-18 03:10:17 +09:00 by davidyuk · 0 comments
davidyuk commented 2023-11-18 03:10:17 +09:00 (Migrated from gitlab.com)

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

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
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#490
No description provided.