Hello nimmers,

I have created a [library](https://github.com/sumatoshi/w8crc) for calculating 
crc's and encountered [some strange 
behavior](https://github.com/sumatoshi/w8crc/blob/facf4f2956f5b5216d78dd6978377069dcd9c1ed/src/w8crc/algobitwise.nim#L187)
 with const computations in the templates (note, rev16b and rev8b works as 
expected!). I made a minimal example for you guys:

revxbits.nim
    
    
    func rev32b*(b: uint32): uint32 = 0'u32
    
    
    Run

api.nim
    
    
    import revxbits
    
    template crcBitwise*(data: string): uint32 =
      const ri = static: 0xFF'u32.rev32b
      #const ri = revxbits.rev32b(0xFF'u32)  ## work!
      0'u32
    
    
    Run

main.nim
    
    
    import api
    # api.nim(4, 30) Error: undeclared field: 'rev32b' for type system.uint32
    # [type declared in /x/nim-1.6.4/lib/system/basic_types.nim(11, 3)]
    echo "123456789".crcBitwise()
    
    
    Run

Is this a bug or a feature? 🤔

Reply via email to