var t: int32
var w: int32
w = 8
t = w and 0b11
t = w or 0b11
t = w and 0b11
t = t or 0b11
t = (w and 0b11) or 0b11 # Error: type mismatch: got (int) but expected 'int32'
Nimrod Compiler Version 0.9.4 (2014-05-20) [Linux: amd64] The lines before the last one gives no error messages.
[Edit] This works as expected:
t = (w and 0b11'i32) or 0b11'i32
But I do not understand the behavior without the 'i32 suffix.
You can assign into int32-type varible values of: int32, range of int32 and literal int.
Expressions mixing some integer type and literal int basically give that integer type (type of t or 0b11 is int32), so it works. But some_integer_variable and int_literal give range type (0..int_literal). The type of range is taken from variable, so type of w and 0b11 is range[0'i32..3'i32] and it can be assigned to int32-variable, so it works too.
The problem is that range_of_in32 or literal_int for some reason results in int and not int32, so cannot be assigned to int32-variable, and this is what you have in the last line.