dapphub / dapphub/daim

Rethink compilation of booleans

Open
#1 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Given this program
```
storage
G : boolean

f ≡ iff G
```
we now generate
```
pragma solidity ^0.4.21;

contract D0 {
uint G;
/* reverts iff !G */
function f() public {
require(G);
}
}
```
Which fails to compile, because G should be declared as bool. / @ggrieco-tob

`uint` was chosen preliminarily instead of `boolean` so that the literal `1` could be assigned to it. Obviously this decision should be revisited now: we have all type information thanks to `Sic.Resolve` now so it could just as well be a boolean. Probably the right thing is to compile it to solidity `boolean`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.