tinyos / nesc

Master nesc repository
GNU General Public License v2.0
100 stars 53 forks source link

Constant folding of && and || fails in compiler error #45

Closed tgtakaoka closed 6 years ago

tgtakaoka commented 6 years ago

The following generic module instantiations can't be compiled because of error in constant folding processing, though other combinations of 0 and 1 work fine.

generic module Module(int value) {...

// compilation error: component arguments must be constants
components new Module(1 && 1) as Error1And1;
components new Module(0 || 0) as Error0Or0;

components new Module(0 && 0) as Ok0And0;
components new Module(0 && 1) as Ok0And1;
components new Module(1 && 0) as Ok1And0;
components new Module(0 || 1) as Ok0Or1;
components new Module(1 || 0) as Ok1Or0;
components new Module(1 || 1) as Ok1Or1;